Compile Error [message #1515757] |
Thu, 18 December 2014 10:48  |
Eclipse User |
|
|
|
The error my picture shown may seem inconsistent with java API.
Do I have solution to fix it?
Attachment: 2.png
(Size: 25.05KB, Downloaded 116 times)
|
|
|
|
Re: Compile Error [message #1516040 is a reply to message #1515921] |
Thu, 18 December 2014 16:09   |
Eclipse User |
|
|
|
That isn't the correct signature for varargs.
The correct signature is:
get(String arg1, String ... arg2)
(String arg1, String[] arg2) says second arg MUST be an array only, not
a variable list. (Though the implementation under the covers is probably
the same).
This is beside making compliance level 1.6 or greater.
On 12/18/2014 8:54 AM, Stephan Herrmann wrote:
> At a quick look it seems you might be compiling at a compliance level
> below 1.5, hence varargs methods are not recognized?
|
|
|
Re: Compile Error - Correction [message #1516046 is a reply to message #1515921] |
Thu, 18 December 2014 16:12   |
Eclipse User |
|
|
|
That isn't the correct signature for varargs.
The correct signature is:
get(String arg1, String ... arg2)
(String arg1, String[] arg2) says second arg MUST be an array only, not
a variable list. (Though the implementation under the covers is probably
the same).
Varags is available in Java 1.5 and above, my mistake.
On 12/18/2014 8:54 AM, Stephan Herrmann wrote:
> At a quick look it seems you might be compiling at a compliance level
> below 1.5, hence varargs methods are not recognized?
|
|
|
|
Re: Compile Error - Correction [message #1516130 is a reply to message #1516064] |
Thu, 18 December 2014 17:25   |
Eclipse User |
|
|
|
Ok, I see. I didn't notice that Paths was a java package class. I was
thinking it was user created.
So yes, it must be the compliance is below 1.5, either by compliance
setting or because an actual JRE less than 1.5 is installed..
I did a test and if compliance is below 1.5 but the JRE installed is 1.5
or greater you get that exact message. And if JRE is 1.4 or lower you
that message.
Rich
On 12/18/2014 11:29 AM, Stephan Herrmann wrote:
> sorry if I answered the wrong question :)
>
> The method Paths.get() indeed being a varargs method: what exactly is
> your question?
>
|
|
|
Re: Compile Error - Correction [message #1516131 is a reply to message #1516130] |
Thu, 18 December 2014 17:27  |
Eclipse User |
|
|
|
Actually just noticed Paths class was created at 1.7. So the JRE must be
1.7 with a compliance less than 1.5 set for the project or the workspace.
On 12/18/2014 12:25 PM, Rich Kulp wrote:
> Ok, I see. I didn't notice that Paths was a java package class. I was
> thinking it was user created.
>
> So yes, it must be the compliance is below 1.5, either by compliance
> setting or because an actual JRE less than 1.5 is installed..
>
> I did a test and if compliance is below 1.5 but the JRE installed is 1.5
> or greater you get that exact message. And if JRE is 1.4 or lower you
> that message.
>
> Rich
>
> On 12/18/2014 11:29 AM, Stephan Herrmann wrote:
>> sorry if I answered the wrong question :)
>>
>> The method Paths.get() indeed being a varargs method: what exactly is
>> your question?
>>
|
|
|
Powered by
FUDForum. Page generated in 0.03940 seconds