0

I am using "java.lang.reflect.Type" in web app project all working fine..but I am stuck with code review how to fix "java.lang.reflect.Type illegal package import " -checkstyle warning.. I am more intrested in explanation of this warning.

Thanks

Gan
  • 624
  • 1
  • 10
  • 31
  • 1
    Are the checkstyle rules the original ones? Or do you have any modifications to them? – Dominik Sandjaja Aug 02 '13 at 11:46
  • @ DaDaDom I believe checkstyle rules are orignal one, also i can't customize any rule b'cz this code review performed by client so i only have report and my source code in my hand – Gan Aug 02 '13 at 11:54
  • @Gan Ask the code reviewer if he messed up his Checkstyle config. This should be by default: http://checkstyle.sourceforge.net/config_imports.html – Sajal Dutta Aug 02 '13 at 11:56
  • 1
    It would probably not be a good idea to ask the reviewer "if he messed up his checkstyle config". ;-) – barfuin Aug 05 '13 at 12:20

2 Answers2

2

The original IllegalImport check only forbids the sun.* packages, so you are looking at a custom rule definition made by your client.

The rule simply means that you are not supposed to use classes from certain packages. This can make sense for various reasons. If your rule forbids java.lang.reflect.Type, then your client does not want you to use Reflection.

Since you say that you may not modify the rules, you will have to find some way to reach your goal without Reflection.

barfuin
  • 16,865
  • 10
  • 85
  • 132
0

Usually packages that are for internal use and version specific. They can be dropped/modified anytime. Like sun.*. Look for anything that is not by default in your Checkstyle config.

Reference.

Sajal Dutta
  • 18,272
  • 11
  • 52
  • 74