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 50435 - Unable to set -source 1.4 to compile a Web Project using NetBeans 4.0 and JDK 5.0
Summary: Unable to set -source 1.4 to compile a Web Project using NetBeans 4.0 and JDK...
Status: RESOLVED DUPLICATE of bug 45374
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: jrojcek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-14 15:52 UTC by ralphlevan
Modified: 2005-01-20 16:46 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 ralphlevan 2004-10-14 15:52:12 UTC
Im trying to compile code generated by the 
Apache Axis wsdl2java utility.  The code is 
sprinkled with references to 
org.apache.axis.enum.* which generates an error 
and a helpful message: (try source 1.4 or lower 
to use enum as an identifier)

I put -source 1.4 in Additional Compile Options 
and it had no effect; I get the same errors about 
enum being a keyword in release 1.5.

I put -source 1.4 bob in Additional Compile 
Options (thinking that the field was being 
ignored) and get a javac usage message.  So the 
additional options are being passed in.

I put -source 1.4 target 1.4 in Additional 
Compile Options (hoping that making the two the 
same would make something happy happen) and I get 
the error message: javac source release 1.5 
requires target release 1.5  This sounds like my 
request for source 1.4 is just plain being 
ignored.

When I try javac source 1.4  at the command 
line, it works like a charm.
Comment 1 Milan Kubec 2004-10-18 09:39:39 UTC
Did you try to change "Java Platform" property in project properties?
You are not supposed to set these settings in Additional Compiler Options.
Comment 2 rafschietekat 2004-10-27 17:30:43 UTC
Confirmed for a standard application, IDE 4.0 Beta 2, JDK 1.5.
I wanted to get rid of "[...] uses unchecked or unsafe operations"
(which is related to generics) in code written for JDK 1.4.
On the command line, adding -source 1.4 is all that is required.
Adding as a compiler option in the project doesn't work (ignored).
Adding "-source 1.4 -target 1.4" (without the quotes) produces the
error "javac: source release 1.5 requires target release 1.5", which
means that -target is recognised and -source is silently ignored.

Java Platform is not a good solution. If it were, there would be no
-source compiler flag, and developers would just change the path to a
previous JDK, foregoing any enhancements, right? (A more advanced
solution might be to make this a file-specific setting, like text
encoding, but I don't want to jump ahead of things.)

The second problem is that a compiler option is *silently* ignored,
which leads to time being wasted while the user is trying to find out
what is going on. I also didn't find a way to see everything that is
being passed to the compiler (maybe through Ant, somehow?).
Comment 3 rafschietekat 2004-10-27 18:29:35 UTC
Another argument: to deploy with JDK 1.5 to pre-1.5 JRE's, either
-source must be set before 1.5, which implies -target 1.4, or -target
must be set before 1.5, which requires -source to be set before 1.5 as
well. That means that JDK 1.5 cannot be used with 4.0 Beta 2 in many
situations, which seems quite inconvenient.
Comment 4 rafschietekat 2004-10-28 09:29:09 UTC
Correction (I wish I could edit some of the text I wrote before): a
pre-1.5 JDK would be necessary anyway (see Cross-Compilation Options
in the documentation for javac, which should illustrate that
requirement with an example like new BigDecimal(0), which previously
promoted 0 to double but now invokes the new constructor
BigDecimal(int), right (not verified)?).

However, if it is necessary to identify the platform at the IDE level,
and this is not done by inspecting the additional options to the
compiler (which seems preferable, because then they could also be
checked for consistency), this still should not mean silently ignoring
an option like -source (I have not checked -bootclasspath yet),
keeping the user in the dark about that rather than actively advising
what to do instead... and why!

I'm also curious whether it will use that platform's javac, see my
question about why javac would offer cross compilation options in the
first place.
Comment 5 Milan Kubec 2004-11-01 07:39:22 UTC
Reassigning for evaluation.
Comment 6 Tomas Zezula 2004-11-01 13:16:42 UTC
The problem is that the ant script already passes the source and
target options to the javac command. Their value is taken from the
used Java plarform.
If you want to change it, you may either create new JDK 1.4 platform.
Or you can use JDK 5.0 and set the properties javac.source, javac.target
in the file project.properties to the value 1.4.
Comment 7 Tomas Zezula 2004-11-01 13:17:29 UTC
Jano, shouldn't we provide UI for that?
Comment 8 Jesse Glick 2004-12-15 19:30:03 UTC
Doesn't the UI spec already cover this?
Comment 9 Jesse Glick 2005-01-20 16:46:57 UTC

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