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 268880 - False Compile Time errors
Summary: False Compile Time errors
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: issues@ide
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-08 01:40 UTC by Zaanzabar
Modified: 2016-11-28 18:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zaanzabar 2016-11-08 01:40:09 UTC
Let me start by saying that I have been using NetBeans IDE for java coding for several years.  I don't use very many features, but in the basic operation of the IDE, I would consider myself Advanced.

That said, I have run into two separate problems occuring at compile time.

Issue 1: very minor bug - about once or twice a day or so, when using "Clean and Build" I get a fairly complex, long, and scary looking error.  I think "null pointer exception" is in there somewhere.  Can't reproduce on command.

Solution:  Just click "Clean and Build" again.  With no changes to the code, this seems to be a issue that can't be code related.



Issue 2:  Major bug - every so often, I get a problem I believe is with libraries not updating.  Let me explain.

I have a relatively complex program I am developing (project folders add up to around 100MB), where I have arranged groups of code on a given subject into separate compiled jars and import them as libraries.  I currently have 11 libraries of my own, and a couple third party ones including LWJGL, and Slick Utils.  My main program then imports all of these libraries, initializes them, and then uses the content.  99.9% of the time, this works like a charm.

Every so often though, I will get an error I can not remove without significant exploratory effort.  The code is fine.  It runs fine, the libraries clean and build fine, and due to the method I have used to fix this issue in the past, I know for a fact my code is fine.

Here's how it works: (to the best of my ability as I can not reproduce it on command)
Library created, compiled, and imported into main program
Main program accesses library just fine.
New feature needed in library, so I add a public method or two
Clean and build library, all fine.
Access new methods from main program.  Runs fine, new feature works as intended.
PROBLEM:  When I clean and build to get a distributable jar, I get a reference that the compiler "cannot find symbol" in reference to the two new methods.  Again, it runs fine in the IDE.

Things I have attempted to fix this:
I try creating a new project, copy all files over to new project.  No luck
Creating a new project accessing new methods.  No luck
Renaming the class that the new methods are in SOMETIMES works, but if I change it back, error returns.

What works most often:
Create new class in library, copy and paste contents of original class with new methods, into new class file, delete old class, resolve all visible errors, leave it under new name, clean and build library, then clean and build main program.  compiles fine.  BUT if I rename newest class back to old name, error returns. Sometimes this process takes half a day of trying things before I resolve it, or I have to go back to a previous build.

Today:
I tried something different.  I removed the trouble library from the project in the properties  window.  This caused errors (verified errors) in 3 different classes in the main project, understandably.  Clean and build: Success??  WITH OBVIOUS ERRORS referencing the missing library.

So, it is compiling with obvious links to a library that is no longer there.  The runtime environment though, references the right library.  This also explains the other errors, as if the compiler is referencing an older version of the library that does not have the methods in it yet.

I have got into the habit of duplicating the entire project every couple days, so if I can't resolve it, I can revert back and only lose a couple days work.  Bosses tend to frown on that if it happens too often.

(NOTE: In the time it took me to type this up, the issue is now resolved somehow.  With library in, with new methods accessed, it clean and builds just fine.  however this has not worked in the past.)

Am I going insane?
Comment 1 Zaanzabar 2016-11-10 15:34:36 UTC
Here is the "Issue 1" error message in its entirety:


ant -q -f "F:\\Dropbox\\2-Documents\\4-Java Programming\\Library\\0-Skybox_v02" -Dnb.internal.action.name=rebuild clean jar
F:\Dropbox\2-Documents\4-Java Programming\Library\0-Skybox_v02\nbproject\build-impl.xml:993: The following error occurred while executing this line:
F:\Dropbox\2-Documents\4-Java Programming\Library\0-Skybox_v02\nbproject\build-impl.xml:837: 
java.lang.NullPointerException
	at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:439)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:519)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:480)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:443)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:409)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:384)
	at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:322)
	at org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs.execute(CopyLibs.java:206)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:396)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
	at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
	at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 0 seconds)
Comment 2 Zaanzabar 2016-11-28 18:38:45 UTC
I was able to duplicate the bug today.  
I have a library called "A_Library"
- In there is a class called "Lib_Foundation"
-   In there is a method called "initialize()"

I added a method called "initialize(String string)"
I added a method called "init()"

both can be accessed from within the IDE.  If I run the program, it runs fine.
"Clean and Build" the Library project - no errors
"Clean and Build" the main project - Errors.

Here is the error message:

ant -q -f "F:\\Dropbox\\2-Documents\\4-Java Programming\\Indev\\3-VR_Fork_v05" -Dnb.internal.action.name=rebuild clean jar
F:\Dropbox\2-Documents\4-Java Programming\Indev\3-VR_Fork_v05\src\A_Library\Test_VR.java:124: error: cannot find symbol
        Lib_Foundation.init();
  symbol:   method init()
  location: class Lib_Foundation
F:\Dropbox\2-Documents\4-Java Programming\Indev\3-VR_Fork_v05\src\A_Library\Test_VR.java:125: error: method initialize in class Lib_Foundation cannot be applied to given types;
        Lib_Foundation          .initialize(configLocation);
  required: no arguments
  found: String
  reason: actual and formal argument lists differ in length
2 errors
F:\Dropbox\2-Documents\4-Java Programming\Indev\3-VR_Fork_v05\nbproject\build-impl.xml:923: The following error occurred while executing this line:
F:\Dropbox\2-Documents\4-Java Programming\Indev\3-VR_Fork_v05\nbproject\build-impl.xml:263: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)