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.

Bug 234103 - java.lang.NoSuchFieldError: NATIVE_HEADER_OUTPUT when running generated test of JavaHInt
Summary: java.lang.NoSuchFieldError: NATIVE_HEADER_OUTPUT when running generated test ...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-07 21:41 UTC by markiewb
Modified: 2013-08-12 07:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
SampleProject (6.71 KB, application/octet-stream)
2013-08-07 21:41 UTC, markiewb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description markiewb 2013-08-07 21:41:48 UTC
Created attachment 138422 [details]
SampleProject

* create an NBM module
* create a fixable JavaHint (check "this contains a fixable hint") --> JavaHint example including test is generated
* run the test ->
ACTUAL: Tests runs green, BUT there are many exceptions in the log - see below
EXPECTED: Tests runs green and there are no exceptions in the log

Aug 07, 2013 11:35:23 PM org.netbeans.modules.java.source.indexing.MultiPassCompileWorker compile
WARNING: MultiPassCompileWorker caused an exception
File: file:/C:/Users/markiewb/Documents/NetBeansProjects/JavaHintEmptyStatement/build/test/unit/work/d.f.A/wp/src/test/Test.java
Root: C:\Users\markiewb\Documents\NetBeansProjects\JavaHintEmptyStatement\build\test\unit\work\d.f.A\wp\src
Bootpath: C:\Program Files\Java\jdk1.7.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.7.0_25\jre\lib\jfr.jar
Classpath: 
Sourcepath: C:\Users\markiewb\Documents\NetBeansProjects\JavaHintEmptyStatement\build\test\unit\work\d.f.A\wp\src
java.lang.NoSuchFieldError: NATIVE_HEADER_OUTPUT
	at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1596)
	at com.sun.tools.javac.api.JavacTaskImpl$2.process(JavacTaskImpl.java:535)
	at com.sun.tools.javac.api.JavacTaskImpl$Filter.run(JavacTaskImpl.java:623)
	at com.sun.tools.javac.api.JavacTaskImpl.generate(JavacTaskImpl.java:538)
	at org.netbeans.modules.java.source.indexing.MultiPassCompileWorker.compile(MultiPassCompileWorker.java:308)
	at org.netbeans.modules.java.source.indexing.JavaCustomIndexer.index(JavaCustomIndexer.java:246)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor$2.run(Indexable.java:161)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater.runIndexer(RepositoryUpdater.java:282)
	at org.netbeans.modules.parsing.spi.indexing.Indexable$MyAccessor.index(Indexable.java:159)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doIndex(RepositoryUpdater.java:2612)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.access$1400(RepositoryUpdater.java:2077)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2502)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work$1.run(RepositoryUpdater.java:2500)
	at org.netbeans.modules.parsing.impl.indexing.errors.TaskCache.refreshTransaction(TaskCache.java:544)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.index(RepositoryUpdater.java:2500)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.scanFiles(RepositoryUpdater.java:3089)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$FileListWork.getDone(RepositoryUpdater.java:3544)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3205)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:5643)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$4900(RepositoryUpdater.java:5309)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$3$1.run(RepositoryUpdater.java:5568)
	at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:96)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$3.call(RepositoryUpdater.java:5564)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$3.call(RepositoryUpdater.java:5560)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:176)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:360)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:74)
	at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:5560)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

I also added the sample project.

Product Version: NetBeans IDE Dev (Build 201307312300)
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b16
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Jan Lahoda 2013-08-12 07:46:34 UTC
I am afraid there is no reasonable way to fix that in java.hints - the correct version of the Java modeling APIs need to be prepended on the bootclasspath, and that needs to be done by setting up the project properly. The guide for that is in the comment at the beginning of the generated test class.

I tried introduce a runtime warning, but I did not find a way to detect the situation (i.e. detecting whether javax.lang.model.element.Element comes from rt.jar or nb-javac-api.jar), as all classes loaded through bootclasspath have the same ProtectionDomain.