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 91455 - Allow JDK/JRE/Java Platform user selection in free-form projects properties for the IDE to use with code completion, ANT builds, IDE features while run inside the IDE.
Summary: Allow JDK/JRE/Java Platform user selection in free-form projects properties f...
Status: RESOLVED DUPLICATE of bug 64160
Alias: None
Product: java
Classification: Unclassified
Component: Freeform (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Milan Kubec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-22 06:17 UTC by _ wadechandler
Modified: 2007-02-13 17:18 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ wadechandler 2006-12-22 06:17:02 UTC
Currently the free-form projects use the JVM the IDE is run to execute ANT
scripts.  This will compile the project and use those specific libraries.  The
IDE then seems to use the source version to map to a given JVM for code
completion and other IDE tasks/features while working with the project.  The ANT
script and the IDE features should for a given free-form project use a user
selected Java Platform like standard projects do in their library section.  This
would allow the user to get around certain issues.  For instance, NB 5.5 can run
on Java 1.6 (6) and it can be registered as a platform.  However, the project
type only allows a source level of 1.5 because of the hard limit of an
enumeration in the project XML schema.  If one has a 1.5 platform registered yet
wants to work with a 1.6 JDK this will not work.  The IDE will use 1.5 for the
code completion instead of 1.6 even when the IDE is run on a 1.6 JVM.  Which
means in NB 5.5 or 5.0 one has to unregister all 1.5 platforms to work on a Java
1.6 project.  Then to keep the free-form aspect use the default JVM ANT is run
under while the scripts tasks are not being run from inside the IDE.  This lets
the user use all the IDE features for free-forms plus fills their need to have a
free-form project without the project being directly tied to IDE for anything
build related.
Comment 1 _ wadechandler 2006-12-23 00:42:22 UTC
I added the following comments to issue 64160.  I'm not sure what the end result
of that issue will be yet, but these two issues go hand in hand.

It makes sense to run ANT under the selected platform as the user may be using a
Java 1.6 or future 1.7 JVM for the free-form project when the IDE may be run on
say 1.5 or vice versa.  That way any issues such as a missing constructor or
method because of overloading will be handled correctly and not leave the issue
hard to track down for an unsuspecting user.  

I have run into issues such as this, and it would not be addressed by only using
the code completion features if the user did not do something such as open all
the files and look at them all as compilation can succeed only to leave issues
at runtime.  A perfect example is if the IDE is run on 1.5 and the user has the
platform set to 1.4 and source level at 1.4 (assuming only code completion uses
1.4 and not compilation).  They may have a file which someone used something
such as a BigDecimal constructor.  In 1.5 there is BigDecimal(int) and
BigDecimal(double), however in 1.4 there is only BigDecimal(double).  If a
source file calls "new BigDecimal(5);" this will cause an issue if the IDE is
run on 1.5 and ANT uses 1.5 to compile the project and the user expects to be
able to run it on 1.4.  What will happen is the 1.5 compiler will link to the
method BigDecimal(int) and when run on a 1.4 JVM the user would get a
LinkageError.  If the user had compiled the sources with 1.4 the compiler would
have promoted the int to a double for the call, and the correct method would
have been linked to, and the user would be able to run the final classes on a
1.4 or 1.5 JVM.  The main issue is that there are transparent issues which arise
with both things (ANT script targets and IDE features) not using the same Java
platform.

Comment 2 Jesse Glick 2007-02-13 17:18:37 UTC
Issue #64160 is already implemented in 6.0 builds. An explicitly selected target
platform controls all aspects of the project's compilation and running. It does
not matter in that case what version of Java you run the IDE on.

*** This issue has been marked as a duplicate of 64160 ***