Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Compile Error
Compile Error [message #1515757] Thu, 18 December 2014 10:48 Go to next message
yuheng zhang is currently offline yuheng zhangFriend
Messages: 1
Registered: December 2014
Junior Member
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 101 times)
Re: Compile Error [message #1515921 is a reply to message #1515757] Thu, 18 December 2014 13:54 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
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 [message #1516040 is a reply to message #1515921] Thu, 18 December 2014 16:09 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #1516064 is a reply to message #1516046] Thu, 18 December 2014 16:29 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
sorry if I answered the wrong question Smile

The method Paths.get() indeed being a varargs method: what exactly is your question?
Re: Compile Error - Correction [message #1516130 is a reply to message #1516064] Thu, 18 December 2014 17:25 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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?
>>
Previous Topic:ASTVisitor's ImportDeclaration from Package or JAR?
Next Topic:Linked list Performance issues
Goto Forum:
  


Current Time: Tue Feb 27 15:00:05 GMT 2024

Powered by FUDForum. Page generated in 0.02317 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top