Comments (2)
Attaching a standalone test program that shows the actual problem will elicit faster investigation - share a program that can be compiled and run with javac and ecj that shows differing behavior.
from eclipse.jdt.core.
Attaching a standalone test program that shows the actual problem will elicit faster investigation - share a program that can be compiled and run with javac and ecj that shows differing behavior.
Sorry, I'm not sure how to test/run annotation processor application using ecj
, but I've attached simple gradle project that just logs element's states on processing.
Here is an instructions of how the problem can be reproduced running it with Eclipse IDE:
Import project
Select File
-> Import
-> Existing Gradle Project
, press Next
. Within Project root directory
field press Browse
and locate the directory containing project, i.e. apt-test
, press Finish
to import.
Build the processor
Select Window
-> Show View
-> Other...
-> Gradle Tasks
to open gradle task panel. Run build
task under processor
subproject. In Project Explorer
, right click on project apt-test
and select Refresh
.
Setup annotation processor
In Project Explorer
, right click on subproject application
and select Properties
. Expand Java Compiler
branch and select Annotaiton Processor
, check the Enable project specific settings
checkbox and make sure other comboboxes Enable annotation processor
and Enable processing in editor
are checked as well. Now expand Annotation Processor
branch and select Factory Path
. Check the Enable project specific settings
checkbox, press Add JARs...
button, locate processor
subproject, expand build/libs
and select processor.jar
, press Apply and Close
.
Compile all
In Eclipse select Project
-> Clean...
. Check the eclipse log file .log
located under .metadata
directory of the workspace:
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:03:28.677
!MESSAGE annotated elements -> [com.example.apt.test.application.A, com.example.apt.test.application.B]
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:03:28.678
!MESSAGE A -> com.example.apt.test.application.A, mirrors -> [@com.example.apt.test.annotation.Foo(name = "A")]
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:03:28.678
!MESSAGE B -> com.example.apt.test.application.B, mirrors -> [@com.example.apt.test.annotation.Foo(name = "B")]
Compile A.java
Open source file A.java
located in application
subproject, add new line and select File
-> Save
, check the logs:
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:06:25.428
!MESSAGE annotated elements -> [com.example.apt.test.application.A]
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:06:25.429
!MESSAGE A -> com.example.apt.test.application.A, mirrors -> [@com.example.apt.test.annotation.Foo(name = "A")]
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:06:25.429
!MESSAGE B -> com.example.apt.test.application.B, mirrors -> []
Compile B.java
Open source file B.java
located in application
subproject, add new line and select File
-> Save
, check the logs:
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:07:10.737
!MESSAGE annotated elements -> [com.example.apt.test.application.B]
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:07:10.737
!MESSAGE A -> com.example.apt.test.application.A, mirrors -> []
!ENTRY org.eclipse.jdt.apt.pluggable.core 1 1 2024-01-11 00:07:10.738
!MESSAGE B -> com.example.apt.test.application.B, mirrors -> [@com.example.apt.test.annotation.Foo(name = "B")]
As it is shown above, only elements that was explicitly triggered by the processor (i.e. included in the round environment) have all annotation mirrors in place on lookup, while other elements that are not triggered by the processor returned without annotation mirrors on lookup.
from eclipse.jdt.core.
Related Issues (20)
- [21] Add AST rewrite support for new String Template DOM nodes HOT 2
- Unchecked casts go unreported with ECJ HOT 1
- Record pattern matching with `null` gives wrong result HOT 3
- Parameters of compact canonical constructor are not marked as mandated HOT 1
- Error in Java Model (code 980): JDT/Autocomplete wrecked sometimes
- Incorrect unused import warning
- The operator += is undefined for the argument type(s) CharSequence, String HOT 3
- [21] Enums cause issues in Record Pattern exhaustiveness checks HOT 4
- [21] Record Patterns in InstanceOf not detected HOT 3
- [switch] Switch expression fails with instanceof + ternary operator combo HOT 5
- CCE while typing try-with-resources
- EXPERIMENT: JDT using Javac instead of ECJ HOT 3
- "Error indexing package names!" HOT 4
- The nullness annotation @Nonnull is not applicable for the primitive type byte HOT 1
- Index is not ready on first use
- slow DiagnoseParser.diagnoseParse(boolean) HOT 3
- silent NumberFormatException in SourceMapper
- [Switch][patterns][record] AssertionError at org.eclipse.jdt.internal.compiler.ast.YieldStatement.addSecretYieldResultValue(YieldStatement.java:120) HOT 14
- StackOverflowError in TypeBinding.getQualifiedName(TypeBinding.java:748) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eclipse.jdt.core.