apache / apache/netbeans

not generating the StaticMetaModel: Annotation processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor Failed

Open
#5,123 0 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 16

### What happened

Trying to move on to the newest version of NB, I noticed some errors warning in a backend project where I have Eclipselink (2.6.1), without validation-api or jakarta.validation-api dependencies and make use of Static Meta model (SMM) entities, for some entities (not all of them) the IDE is not generating the SMM and showing the following:

```
Annotation processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor failed with an exception: Could not initialize class org.eclipse.persistence.internal.helper.ClassConstants
org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getDefaultIdentityMapClass(AbstractIdentityMap.java:339)
org.eclipse.persistence.sessions.Project.(Project.java:109)
org.eclipse.persistence.sessions.Project.(Project.java:208)
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:361)
org.netbeans.modules.java.source.indexing.APTUtils$ErrorToleratingProcessor.process(APTUtils.java:984)
com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1008)
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:924)
com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2300(JavacProcessingEnvironment.java:113)
com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1252)
com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1367)
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1234)
org.netbeans.lib.nbjavac.services.NBJavaCompiler.processAnnotations(NBJavaCompiler.java:62)
com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1133)
com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:348)
com.sun.tools.javac.api.JavacTaskImpl.enter(JavacTaskImpl.java:28...
```

the same project works fine in NB 12 and 12.6

### How to reproduce

_No response_

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 10

### JDK

OpenJDK 11 Travis

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

_No response_

### Are you willing to submit a pull request?

No

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure on Apache NetBeans 16 with EclipseLink 2.6.1 and JDK 11, then compare annotation processing with NetBeans 12 and 12.6. Trace the path through org.netbeans.modules.java.source.indexing.APTUtils and CanonicalModelProcessor; done means StaticMetaModel entities are generated without the ClassConstants failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.