donderdag 4 mei 2017

Unused Java actions resulting in compilation error

It has been a while since my last post. I'm still working on Mendix (currently on ancient version 5.19) and just hit a snag while refactoring some code developed by a Java fan. A lot of Java actions were used in a complex piece of code, which turned out impossible to maintain. After a lot of changes, 'exclude from project' and the first part of my new code being ready to test, I tried to do a  Run Locally and failed at the Java compilation stage. Nothing worked, clean deployment directory, synchronise project directory, manually deleting the deployment directory, etc etc etc.
I kept getting these errors:

  • RestServiceHandler.java:251: warning: '_' used as an identifier
  • cannot find symbol
  • package (xyz) does not exist
  • deployment\build_core.xml:27: Compile failed; see the compiler error output for details
I checked and rechecked, all Java actions were excluded or removed, enums were removed, all seemed as it should. I re-included the Java actions and then in the Mendix modeler I would see errors comparable to the java compilation errors (for example, not being able to find one of the old enums, etc). I deleted the javaactions instead of excluding, also no joy. Only possible explanation: somewhere some garbage Java code remained on disk, which somehow remained part of the compilation. 
Checking the "javasource\(module name)\actions\" and "..\proxies" directory showed me the culprits. Deleted documents from the project were still there and that failed my compilation.

Solution: I deleted the now unused javasource files from the project directory "javasource\(module name)\actions\" and the compilation went fine.


Errors in the build xml:
    [javac]   symbol:   class AttributeSettings
    [javac]   location: package changetracking.proxies
    [javac] private changetracking.proxies.EventType eventType;
    [javac]                              ^                                                                                            ^
    [javac] List attributeSettingsList = StaticSettings
    [javac]                                                ^
    [javac]   symbol:   variable StaticSettings
    [javac]   location: class BeforeCommitChangeTracking
    [javac] D:\MendixProj\xxx - Branch - yyyy\javasource\changetracking\actions\BeforeCommitChangeTracking.java:47: error: cannot find symbol
    [javac] for (AttributeSettings attributeSettings : attributeSettingsList) {
    [javac]     ^
    [javac]   symbol:   class AttributeSettings
    [javac]   location: class BeforeCommitChangeTracking
    [javac] D:\MendixProj\xxx - Branch - yyyy\javasource\changetracking\actions\BeforeCommitChangeTracking.java:59: error: package EventType does not exist
    [javac] EventType.BeforeCommit.toString())
    [javac]         ^
    [javac] D:\MendixProj\xxx - Branch - yyyy\javasource\changetracking\actions\EventChangeTracking.java:29: error: cannot find symbol
    [javac] this.eventType = eventType == null ? null : changetracking.proxies.EventType.valueOf(eventType);
    [javac]                                                                  ^
    [javac]   symbol:   class EventType
    [javac]   location: package changetracking.proxies
    [javac] Note: D:\MendixProj\xxx - Branch - yyyy\javasource\com\mendix\core\Core.java uses unchecked or unsafe operations.


Geen opmerkingen:

Een reactie posten