Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using assert with Eclipse compiler
Using assert with Eclipse compiler [message #108468] Tue, 21 October 2003 22:51 Go to next message
Eclipse UserFriend
I am trying to use assert with the Eclipse M4 compiler and the Sun JDK
1.4.2.

I have set the following options for the compiler
Compiler compliance level 1.4
Generated .class file compatibility 1.4
Source compatibility 1.4
Report 'assert' as identifier Error

However with these settings all uses of assert are flagged as errors. What
else do I need to do to get asserts going?

Regards

Jonathan Gossage
Re: Using assert with Eclipse compiler [message #108640 is a reply to message #108468] Wed, 22 October 2003 05:23 Go to previous messageGo to next message
Eclipse UserFriend
Report 'assert' as identifier Ignore

"Jonathan Gossage" <jgossage@magma.ca> wrote in message
news:bn4rat$e1$1@eclipse.org...
> I am trying to use assert with the Eclipse M4 compiler and the Sun JDK
> 1.4.2.
>
> I have set the following options for the compiler
> Compiler compliance level 1.4
> Generated .class file compatibility 1.4
> Source compatibility 1.4
> Report 'assert' as identifier Error
>
> However with these settings all uses of assert are flagged as errors. What
> else do I need to do to get asserts going?
>
> Regards
>
> Jonathan Gossage
>
>
Re: Using assert with Eclipse compiler [message #108680 is a reply to message #108640] Wed, 22 October 2003 06:53 Go to previous messageGo to next message
Eclipse UserFriend
When I try to do this Eclipse gives an error message at the top of the
preference page stating
"When source compatibility is 1.4. 'assert' cannot be an identifier".

That's what started this query as I had already tried this. Is this a bug
then?

Regards

Jonathan Gossage

"Jerome Lanneluc" <jerome_lanneluc@fr.ibm.com> wrote in message
news:bn5ia2$hlk$1@eclipse.org...
> Report 'assert' as identifier Ignore
>
> "Jonathan Gossage" <jgossage@magma.ca> wrote in message
> news:bn4rat$e1$1@eclipse.org...
> > I am trying to use assert with the Eclipse M4 compiler and the Sun JDK
> > 1.4.2.
> >
> > I have set the following options for the compiler
> > Compiler compliance level 1.4
> > Generated .class file compatibility 1.4
> > Source compatibility 1.4
> > Report 'assert' as identifier Error
> >
> > However with these settings all uses of assert are flagged as errors.
What
> > else do I need to do to get asserts going?
> >
> > Regards
> >
> > Jonathan Gossage
> >
> >
>
>
Re: Using assert with Eclipse compiler [message #108709 is a reply to message #108680] Wed, 22 October 2003 07:12 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, I misread your settings. In Source 1.4 compatibility, 'assert' cannot
be used as an identifier (e.g. for a local variable name). So it can only be
reported as an error if this is the case.

So with the the following settings:
Compiler compliance level 1.4
Generated .class file compatibility 1.4
Source compatibility 1.4
Report 'assert' as identifier Error

I'm able to compile the following class:
public class X {
void foo() {
assert true;
}
}

but this fails to compile (as expected since 'assert' is used as an
identifier):
public class X {
void foo() {
boolean assert = true;
}
}

Do you have a case where you use 'assert' as the 'assert' keyword and this
fails to compile?
If you do, please fill a bug report against JDT/Core.

Jerome

"Jonathan Gossage" <jgossage@magma.ca> wrote in message
news:bn5ni8$mef$1@eclipse.org...
> When I try to do this Eclipse gives an error message at the top of the
> preference page stating
> "When source compatibility is 1.4. 'assert' cannot be an identifier".
>
> That's what started this query as I had already tried this. Is this a bug
> then?
>
> Regards
>
> Jonathan Gossage
>
> "Jerome Lanneluc" <jerome_lanneluc@fr.ibm.com> wrote in message
> news:bn5ia2$hlk$1@eclipse.org...
> > Report 'assert' as identifier Ignore
> >
> > "Jonathan Gossage" <jgossage@magma.ca> wrote in message
> > news:bn4rat$e1$1@eclipse.org...
> > > I am trying to use assert with the Eclipse M4 compiler and the Sun JDK
> > > 1.4.2.
> > >
> > > I have set the following options for the compiler
> > > Compiler compliance level 1.4
> > > Generated .class file compatibility 1.4
> > > Source compatibility 1.4
> > > Report 'assert' as identifier Error
> > >
> > > However with these settings all uses of assert are flagged as errors.
> What
> > > else do I need to do to get asserts going?
> > >
> > > Regards
> > >
> > > Jonathan Gossage
> > >
> > >
> >
> >
>
>
Re: Using assert with Eclipse compiler [message #108727 is a reply to message #108709] Wed, 22 October 2003 07:58 Go to previous messageGo to next message
Eclipse UserFriend
Unfortunately, with those settings I am not able to compile
public class X {
void foo() {
assert true;
}

Is it possible that honouring assert is also tied into one of your internal
DEBUG specifications that has been left in inadvertently?
I.E. one of those debug variables that must also be set that some Eclipse
people use during early release of a new capability.

I am encountering this problem on every machine that I try this.

Regards

Jonathan Gossage

"Jerome Lanneluc" <jerome_lanneluc@fr.ibm.com> wrote in message
news:bn5okm$njd$1@eclipse.org...
> Sorry, I misread your settings. In Source 1.4 compatibility, 'assert'
cannot
> be used as an identifier (e.g. for a local variable name). So it can only
be
> reported as an error if this is the case.
>
> So with the the following settings:
> Compiler compliance level 1.4
> Generated .class file compatibility 1.4
> Source compatibility 1.4
> Report 'assert' as identifier Error
>
> I'm able to compile the following class:
> public class X {
> void foo() {
> assert true;
> }
> }
>
> but this fails to compile (as expected since 'assert' is used as an
> identifier):
> public class X {
> void foo() {
> boolean assert = true;
> }
> }
>
> Do you have a case where you use 'assert' as the 'assert' keyword and this
> fails to compile?
> If you do, please fill a bug report against JDT/Core.
>
> Jerome
>
> "Jonathan Gossage" <jgossage@magma.ca> wrote in message
> news:bn5ni8$mef$1@eclipse.org...
> > When I try to do this Eclipse gives an error message at the top of the
> > preference page stating
> > "When source compatibility is 1.4. 'assert' cannot be an identifier".
> >
> > That's what started this query as I had already tried this. Is this a
bug
> > then?
> >
> > Regards
> >
> > Jonathan Gossage
> >
> > "Jerome Lanneluc" <jerome_lanneluc@fr.ibm.com> wrote in message
> > news:bn5ia2$hlk$1@eclipse.org...
> > > Report 'assert' as identifier Ignore
> > >
> > > "Jonathan Gossage" <jgossage@magma.ca> wrote in message
> > > news:bn4rat$e1$1@eclipse.org...
> > > > I am trying to use assert with the Eclipse M4 compiler and the Sun
JDK
> > > > 1.4.2.
> > > >
> > > > I have set the following options for the compiler
> > > > Compiler compliance level 1.4
> > > > Generated .class file compatibility 1.4
> > > > Source compatibility 1.4
> > > > Report 'assert' as identifier Error
> > > >
> > > > However with these settings all uses of assert are flagged as
errors.
> > What
> > > > else do I need to do to get asserts going?
> > > >
> > > > Regards
> > > >
> > > > Jonathan Gossage
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Re: Using assert with Eclipse compiler [message #108767 is a reply to message #108727] Wed, 22 October 2003 08:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: olivier_thomann.ca.ibm.comNOSPAM

Le Wed, 22 Oct 2003 07:58:48 -0400, "Jonathan Gossage"
<jonathan@cryptocard.com> a écrit :
>Unfortunately, with those settings I am not able to compile
>public class X {
> void foo() {
> assert true;
> }
>
>Is it possible that honouring assert is also tied into one of your internal
>DEBUG specifications that has been left in inadvertently?
>I.E. one of those debug variables that must also be set that some Eclipse
>people use during early release of a new capability.
>
>I am encountering this problem on every machine that I try this.
Are you sure that you don't have a different compiler setting for the
project in which you compile this source. You can define compiler
settings per project and maybe this is the problem in your case.
I tried Jérôme example with Eclipse M4 and it worked.
--
Olivier
Re: Using assert with Eclipse compiler [message #108885 is a reply to message #108767] Wed, 22 October 2003 11:10 Go to previous message
Eclipse UserFriend
I will have to check this when I get home. At work when I tried it I was
able to get it to work.

Regards

Jonathan Gossage

"Olivier Thomann" <olivier_thomann@ca.ibm.comNOSPAM> wrote in message
news:4jucpvkl6buthi7n40n20p07p3rmkqpgsc@4ax.com...
> Le Wed, 22 Oct 2003 07:58:48 -0400, "Jonathan Gossage"
> <jonathan@cryptocard.com> a
Previous Topic:New synchronize view in M4 - inappropriate refreshes?
Next Topic:Can I use NTEmacs as my code editor?
Goto Forum:
  


Current Time: Mon Sep 22 19:18:38 EDT 2025

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

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

Back to the top