Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

How to use assert with java 1.4?

4 réponses
Avatar
Patrick Gelin
Hi,

I tryed "assert" like this:

boolean notnul = (arg0.getAttribute("DefaultView")!=null);
assert notnull;

but I got the error message:

"assert cannot be resolved to a type"

I'm using eclipse IDE 3.1 configured with Java 1.4 compiler.

Any help is welcome.
--

4 réponses

Avatar
Olivier Thomann
I tryed "assert" like this:
boolean notnul = (arg0.getAttribute("DefaultView")!=null);
assert notnull;
but I got the error message:
"assert cannot be resolved to a type"

I'm using eclipse IDE 3.1 configured with Java 1.4 compiler.
Tu n'utilises pas les bons paramètres.

Va dans Java>Compiler>JDK Compliance>
Déselectionne "Use default compliance settings".
Mets 1.4 dans "Generated .class files compatibility"
Mets 1.4 dans "Source compatibility"
Mets Error dans "Disallow identifiers called 'assert'".
Mets Error dans "Disallow identifiers called 'enum'".

Ce dernier point n'est pas à strictement parler nécessaire, mais ça va
te faciliter le passage à 1.5 :-).
Ensuite tu recompiles le tout et le tour est joué.
--
Olivier

Avatar
Patrick Gelin
Olivier Thomann wrote:

I tryed "assert" like this:
boolean notnul = (arg0.getAttribute("DefaultView")!=null);
assert notnull;
but I got the error message:
"assert cannot be resolved to a type"

I'm using eclipse IDE 3.1 configured with Java 1.4 compiler.
Tu n'utilises pas les bons paramètres.

Va dans Java>Compiler>JDK Compliance>
Déselectionne "Use default compliance settings".
Mets 1.4 dans "Generated .class files compatibility"
Mets 1.4 dans "Source compatibility"
Mets Error dans "Disallow identifiers called 'assert'".
Mets Error dans "Disallow identifiers called 'enum'".

Ce dernier point n'est pas à strictement parler nécessaire, mais ça va
te faciliter le passage à 1.5 :-).
Ensuite tu recompiles le tout et le tour est joué.
--
Olivier
ok, it compiling! Thank you very much olivier and have a good luke for

yours...
--


Avatar
Patrick Gelin
Olivier Thomann wrote:

The compilation is ok, but the assert don't stop at run time... I included
it into a portlet running over TOMCAT, so do I need to start TOMCAT in
debug mode????

Thanks for your help.
Avatar
Simon OUALID
Patrick Gelin wrote:
Olivier Thomann wrote:

The compilation is ok, but the assert don't stop at run time... I included
it into a portlet running over TOMCAT, so do I need to start TOMCAT in
debug mode????

Thanks for your help.




Have you tried to run Tomcat with the -enableassertions option ?

Symon