как отключить автобоксинг в jdk1.5.0 во время компиляции?
От: Волк-Призрак Россия http://ghostwolf.newmail.ru
Дата: 18.12.04 07:57
Оценка:
Я както создавал топик с темой на подобие "JBuilder7+jdk1.5.0=verifiy error". Теперь я нашел в нете тему в импортном формуме с такой тематикой, это на форуме sun. Там были советы вроде добавление параметра "-noverify", но это только "решение на одну машину". Самое разумное предмположение, которое там прозвучало, это то, что автобоксинг "во всём виноват". Но там также было сказано:

I suspect it is a JBuilder — java 1.5 compatibility issue. I created a simple java bean using JBuilder6 and the 1.5 SDK. When I try to run the packager for the ActiveX bean bridge, I get a
"java.lang.VerifyError Incompatible object argument for function call".

I wonder if the problem lies in the new AutoBoxing/UnBoxing feature. I am suspicious since I always get this error when trying to run the packager if I have this line somewhere in my code:
System.out.println("text" + Integer.toString(1) + "text");
However, this is OK:
System.out.println("text" + Integer.toString(1));
And this is OK:
System.out.println(Integer.toString(1) + "text");

And then I tried compiling the bean using the NetBeans IDE, then running the packager, and everythng worked fine!

по поводу

Your program

public class Tester {
public Tester() {
String ONE = "abc";
String TWO = "def";
System.out.println(ONE + " " + TWO);
}
public static void main(String[] args) {
Tester tester1 = new Tester();
}
}


runs fine for me on Debian GNU/Linux

|> javac Tester.java
|> java Tester
abc def
|> java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
|>

и

It's been a month and a half since I used the -noverify option in the VM parameters to get by this error and I ran into it again in a different project. So after some time I narrowed the problem down into a very simple program, and I found a way around it. Here is the program with the error:

public class Tester {
public Tester() {
String ONE = "abc";
String TWO = "def";
System.out.println(ONE + " " + TWO);
}
public static void main(String[] args) {
Tester tester1 = new Tester();
}
}

This code generates the java.lang.VerifyError at runtime. Now, instead of using the "+" operator inside the catch block, break it up into separate print statements as follows:

public class Tester {
public Tester() {
String ONE = "abc";
String TWO = "def";
System.out.print(ONE);
System.out.print(" ");
System.out.println(TWO);
}
public static void main(String[] args) {
Tester tester1 = new Tester();
}
}

The error disappears (at least it did for me). Interestingly, the first class runs fine if you exclude the " " literal. The class also runs fine if you include the " " literal, but exclude either the ONE or TWO variable. But again, the error only occurs when you include all three in the same println() statement using the "+" operator. I have no idea why. Does anyone know?

Такие вот пироги. Правда поиск в гугле вёлся по поводу "using jdk 1.5.0 with jbuilder7" и "another compiler with jbuilder7".
while(Life.getClass().getClassLoader()==Religion.GOD){Life.be();};
Скажи .net корпорации Microsoft! (c) ghostwolf 2004
7 раз поищи в стандартной библиотеке, 1 раз накодь своё.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.