This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 152352 [details] Maven projects demoing failure of including parameter names There seems to be an issue regarding the use of javac's -parameters in Maven projects. When configuring the compiler plugin like so: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <target>1.8</target> <source>1.8</source> <compilerArgs> <arg>-parameters</arg> </compilerArgs> </configuration> </plugin> i expect that the parameter names are retained, for concrete classes as well as abstract classes, interfaces and constructors according to the new Java 8 features regarding parameter names (http://docs.oracle.com/javase/tutorial/reflect/member/methodparameterreflection.html). The concrete example for me using this is Spring Data JPA, where you can declare interfaces and abstract methods that are translated into JPA queries or mapped to existing named queries with named parameters. You can either choose to add an annotion to the interface methods (like i did before) or optain the mapping from parameter names. Attached is a project that demonstrate the problem. There's a JPA entity with two named queries and a Spring Data JPA Repository that make use of those queries. The queries contains named parameters. First repo method is annotated with the parameter name, the second not. Spring Data JPA generates implementation on the fly (don’t ask me how). Before Java 8 omitting the @Param wasn’t possible even with debug enabled because there’s no implementation of that method. Running this in NetBeans 8.0.2 Product Version: NetBeans IDE 8.0.2 (Build 201411181905) Java: 1.8.0_31; Java HotSpot(TM) 64-Bit Server VM 25.31-b07 Runtime: Java(TM) SE Runtime Environment 1.8.0_31-b13 System: Mac OS X version 10.10.2 running on x86_64; UTF-8; de_DE (nb) User directory: /Users/msimons/Library/Application Support/NetBeans/8.0.1 Cache directory: /Users/msimons/Library/Caches/NetBeans/8.0.1 Basically the generated parameters seem to stay intact when i hit clean & build, then run or debug. The moment i change the customer repository (just adding an empty line is enough), then debug, the call to findOneByUpperCaseNameWithoutAnnotation fails because Spring Data doesn’t fill the parameter name. There's an additional readme inside the attached archive.
Is there any workaround for this? I don't see any place to provide compiler arguments in a maven project other than the pom. Is there any place to add the -parameters argument to CompileOnSave?
Same problem here. Product Version: NetBeans IDE 8.1 (Build 201510222201) Java: 1.8.0_66; Java HotSpot(TM) 64-Bit Server VM 25.66-b18 Runtime: Java(TM) SE Runtime Environment 1.8.0_66-b18 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Is there already a workaround or fix available?
Any chance auf this being addressed anytime soon? Really annoying, especially with Spring Data JPA and query parameter resolution. Thanks.
I guess the logic is hidden somewhere in org.netbeans.modules.maven.cos.CosChecker
@milanka@netbeans.org: Do not change the version! The version field contains the NB version the issue has been found first. Please vote instead! Resetting changes.
The java.source.base part: http://hg.netbeans.org/jet-main/rev/ba0af206837d
Now maven project needs to implement: 1) CompilerOptionQuieryImplementation providing the options from pom's compiler-plugin 2) Add COQI merger into project's lookup LookupMergerSupport.createCompilerOptionsQueryMerger()
> Now maven project needs to implement: > 1) CompilerOptionQuieryImplementation providing the options from pom's compiler-plugin > 2) Add COQI merger into project's lookup LookupMergerSupport.createCompilerOptionsQueryMerger() thanks
fixed in jet-main #5b7e60e4eb38
please note that we do not plan to add this into the next 8.2 patch release as the necessary infrastructure in java.source (o.n.spi.java.queries.CompilerOptionsQueryImplementation) was introduced just recently into dev builds and is hard to backport
Is there any workaround in the meantime? Any way to patch my netbeans instalation with the fix? when its planned the bugfix release for this issue?
Integrated into 'main-silver', will be available in build *201611230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/ba0af206837d User: Tomas Zezula <tzezula@netbeans.org> Log: #250858:javac -parameters Option and "Compile on save" in Maven projects