Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT TypeOracle.getTypes does not return all types

I have a custom generator that generates code only for somes classes in my project. The following code is at the beginning of the generate method, and puts all the classes I will need to work on in the clazzes list

TypeOracle oracle = context.getTypeOracle();
JClassType markerInterfaceType = oracle.findType(MY_PARENT_CLASS.class.getName());
List<JClassType> clazzes = new ArrayList<JClassType>();
for (JClassType classType : oracle.getTypes()) {
  if (!classType.equals(markerInterfaceType)
      && classType.isAssignableTo(markerInterfaceType)) {
    clazzes.add(classType);
  }
}

This code has been unchanged for more than a year, but since last week it seems that a few classes are not taken into account by the generator.

After some digging, i found that those classes are not even in the list returned by oracle.getTypes()

  • Those ignored classes are not newly created classes (some were left unchanged for several month)
  • As far as i can tell, there is no way to differenciate a class that will be ignored from any other class
  • No upgrade in our gwt version was made (some of us are using 2.5.0, others 2.5.1)
  • No upgrade in packages used by those classes either
  • oracle.findType(MISSING_CLASS.class.getName()) returns null
  • the problem appears only for some people, but not on the same classes
  • renaming problematic classes seems to correct the problem

My best guess would be that i have a cache problem somewhere, but i have no idea where to look.

like image 414
Garagos Avatar asked Aug 17 '26 06:08

Garagos


1 Answers

Maybe too late for the answer but I was facing this issue for the last 3 days. No amount of clearing gwt-UnitCache folder was helping. Finally found the problem. The class which was not getting picked up by oracle had a reference of a gwt-ext class and I had not inherited gwt-ext in my module definition(.gwt.xml file). Removing that reference fixed the problem. So, using anything in your class which might not be referenced in your module definition or is not part of can cause your class not getting picked up by Oracle. Cheers!

like image 134
Anand Saha Avatar answered Aug 18 '26 20:08

Anand Saha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!