Compliance check fail with overriden java classes
Nightbringer42 opened this issue · comments
The bug appear when the compliance-check goal is called during the build goal.
It seems that the classes checked by the goal uses the wrong class, like java.lang.Object from Java instead of it's CN1 counterpart, same for InstanciationException in another case.
Steps to reproduce the behavior:
- Create a new barebone app with the starter, in my case I've selected the Intellij Idea version
- Launch the app in Idea, no problem
- Add lib cn1-data-access via the settings extensions, or directly copying the source into the project (only three classes)
- Create a basic PropertyBusinessObject and a DAO for it
- Instanciate the DAO in the main class of the app
- Compliance check fail like shown below
Maven log snippet :
[INFO] Warning: ca.weblite.codename1.db.DAO: can't find referenced class ca.weblite.codename1.db.DAO$java.lang.Object
maven-check-compliance.log
In another project running the lib, but with the ant build system, everything still works fine and the app run smoothly on both Android and iOS.
Another one uses InstanciationException, and the compliance check fail to find ReflectiveOperationException, which is extended by InstanciationException in the JDK, but not in the CN1 overriden class. Like the previous example, everything works fine with the ant build.
Environment:
- OS: Windows 10
- IDE : IntelliJ IDEA 2021.3.2 Ultimate
- Java : Oracle JDK 1.8.0_281
Basic Intellij IDEA Project :
myapp.zip
I have just migrated the data access lib to maven so that you can include it via a simple maven dependency now.
<dependency>
<artifactId>data-access-lib</artifactId>
<groupId>com.codenameone</groupId>
<version>1.0.1</version>
<type>pom</type>
</dependency>
Add this to the dependencies section in your common/pom.xml file.
NOTE: It may take a few hours before this is live, as I just published it to maven central and it takes a bit to propagate.
You'll also need to remove the old dependency that was added for the old cn1lib. You'll also find that in the common/pom.xml file.
Hello Steve, I have updated my minimum case project with the new maven dependency, and it still throws the same error at compliance-check :
[INFO] Warning: ca.weblite.codename1.db.DAO: can't find referenced class ca.weblite.codename1.db.DAO$java.lang.Object
@Nightbringer42 Try starting with a fresh project, and use the maven dependency for data-access-lib. It is possible that remnants of the old cn1lib dependency are still in your old project and triggering that warning.