Bugs in Intellij 5 or did I miss something ...

Hi, I have set the JDK to 1.5 , and so far the thing that work for 1.5 such as static imports, generics is working except

the autoboxing seem to cause issue ....
Try putting the following in intellij after setting java 1.5 support and the add function will be error ... though it should not ....

List onlyStrings = new LinkedList]]>( );

onlyStrings.add("Legal addition");

Could this be a bug ??

5 comments
Comment actions Permalink

This is strange. You should try restarting IDEA and making sure your language
level is at 5.0. You might also want to clear IDEA's caches at
~/.IntelliJIDEA/system/cache/ or so. (Replace ~ with C:\Documents and
Settings\]]> if you're on Windows.)

matthewarena wrote:

Hi, I have set the JDK to 1.5 , and so far the thing that work for 1.5 such as static imports, generics is working except

the autoboxing seem to cause issue ....
Try putting the following in intellij after setting java 1.5 support and the add function will be error ... though it should not ....

List<String> onlyStrings = new LinkedList<String>( );

onlyStrings.add("Legal addition");

Could this be a bug ??

0
Comment actions Permalink

hmmm try putting the following code

import static java.lang.System.out;
import static java.lang.System.err;

import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;

public class ForInTest
{

public static void main(String[] args)
{
String[] names = {"Mary", "David", "Handsone", "Information"};

for(String i: names)
{
out.println(i);
}

int[] i1 = new int[] {33,22,11};
int[] i2 = new int[] {33,22,11};

System.out.println(Arrays.equals(i1, i2));

Arrays.sort(i1);

for(int i: i1)
out.println(i);*/

}

Integer i = 33;
int int1 = i;

Boolean jj = true;


List onlyStrings = new LinkedList]]>( );

onlyStrings.add("Legal addition");

}


and U see that the add function is error in intellij though it is valid in Java 1.5

thank

0
Comment actions Permalink

matthewarena wrote:

onlyStrings.add("Legal addition");


This line of code is not inside a method or a static or instance
initializer, and so it is illegal Java syntax, regardless of 1.5 or 1.4
or whatever.

--
Rob Harwood
Software Developer
JetBrains Inc.
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

That code won't compile and is not valid Java code. You're trying to call a
method outside of a method body. The error IDEA shows is misleading. You need to
put that add() call inside some method like main().

matthewarena wrote:

hmmm try putting the following code

import static java.lang.System.out;
import static java.lang.System.err;

import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;

public class ForInTest
{

public static void main(String[] args)
{
String[] names = {"Mary", "David", "Handsone", "Information"};

for(String i: names)
{
out.println(i);
}

int[] i1 = new int[] {33,22,11};
int[] i2 = new int[] {33,22,11};

System.out.println(Arrays.equals(i1, i2));

Arrays.sort(i1);

for(int i: i1)
out.println(i);*/

}

Integer i = 33;
int int1 = i;

Boolean jj = true;


List<String> onlyStrings = new LinkedList<String>( );

onlyStrings.add("Legal addition");

}


and U see that the add function is error in intellij though it is valid in Java 1.5

thank

0
Comment actions Permalink

Hi... Problem solved ... Apology ...
It is a mistake in the code ...
I did not notice that a statement is executed outside of method ... In this case the add statement will give a error because it is not a declaration ...

Thank for your attention....

0

Please sign in to leave a comment.