Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compliance check fail with overriden java classes #3610

Open
Nightbringer42 opened this issue Jul 8, 2022 · 3 comments
Open

Compliance check fail with overriden java classes #3610

Nightbringer42 opened this issue Jul 8, 2022 · 3 comments
Assignees

Comments

@Nightbringer42
Copy link

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:

  1. Create a new barebone app with the starter, in my case I've selected the Intellij Idea version
  2. Launch the app in Idea, no problem
  3. Add lib cn1-data-access via the settings extensions, or directly copying the source into the project (only three classes)
  4. Create a basic PropertyBusinessObject and a DAO for it
  5. Instanciate the DAO in the main class of the app
  6. 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

@shannah
Copy link
Collaborator

shannah commented Jul 9, 2022

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.

@Nightbringer42
Copy link
Author

Nightbringer42 commented Jul 11, 2022

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

@shannah
Copy link
Collaborator

shannah commented Sep 11, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants