Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » avoid @SuppressWarnings("all") in Xtend batch compiler
avoid @SuppressWarnings("all") in Xtend batch compiler [message #1433817] Mon, 29 September 2014 09:22 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1815
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

is there a way to avoid the generation of @SuppressWarnings("all") when
invoking the headless Xtend compiler? I don't mind this annotation, but
it looks like that this annotation will prevent Sonarqube from reporting
possible issues on the generated Java code (see
http://sonarqube.15.x6.nabble.com/sonarqube-findbugs-and-generated-sources-td5028237.html).

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1433874 is a reply to message #1433817] Mon, 29 September 2014 10:58 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

there is currently no generic way to disable that for Xtend. You can use
another GeneratorConfig for your own languages but Xtend will generate
@SuppressWarnings if no user-defined @SuppressWarnings is present.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 29.09.14 11:22, schrieb Lorenzo Bettini:
> Hi
>
> is there a way to avoid the generation of @SuppressWarnings("all") when
> invoking the headless Xtend compiler? I don't mind this annotation, but
> it looks like that this annotation will prevent Sonarqube from reporting
> possible issues on the generated Java code (see
> http://sonarqube.15.x6.nabble.com/sonarqube-findbugs-and-generated-sources-td5028237.html).
>
> cheers
> Lorenzo
>
Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1433949 is a reply to message #1433874] Mon, 29 September 2014 12:58 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1815
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 29/09/2014 12:58, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> there is currently no generic way to disable that for Xtend. You can use
> another GeneratorConfig for your own languages but Xtend will generate
> @SuppressWarnings if no user-defined @SuppressWarnings is present.
>
> Best,
> Sebastian

Hi Sebastian

I tried to write this Xtend class

@SuppressWarnings("serial")
class XtendGreeting {

def greeting() {
"Hello, world."
}

def useEquals() {
// 2 findbugs issues:
// findbugs:DM_NUMBER_CTOR
// findbugs:EC_UNRELATED_TYPES
new Integer(0).equals("foo");
}
}

but the generated Java class still shows as follows:

@SuppressWarnings("all")
public class XtendGreeting {
public String greeting() {
return "Hello, world.";
}

public boolean useEquals() {
Integer _integer = new Integer(0);
return _integer.equals("foo");
}
}

am I missing something?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1433959 is a reply to message #1433949] Mon, 29 September 2014 13:18 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hmm obviously I'm the one who missed something. I expected it to use
your explicitly suppressed warnings, but apparently it doesn't work.

Could you please file a ticket and describe why you want to suppress the
suppress warnings annotation?

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 29.09.14 14:58, schrieb Lorenzo Bettini:
> On 29/09/2014 12:58, Sebastian Zarnekow wrote:
>> Hi Lorenzo,
>>
>> there is currently no generic way to disable that for Xtend. You can use
>> another GeneratorConfig for your own languages but Xtend will generate
>> @SuppressWarnings if no user-defined @SuppressWarnings is present.
>>
>> Best,
>> Sebastian
>
> Hi Sebastian
>
> I tried to write this Xtend class
>
> @SuppressWarnings("serial")
> class XtendGreeting {
>
> def greeting() {
> "Hello, world."
> }
>
> def useEquals() {
> // 2 findbugs issues:
> // findbugs:DM_NUMBER_CTOR
> // findbugs:EC_UNRELATED_TYPES
> new Integer(0).equals("foo");
> }
> }
>
> but the generated Java class still shows as follows:
>
> @SuppressWarnings("all")
> public class XtendGreeting {
> public String greeting() {
> return "Hello, world.";
> }
>
> public boolean useEquals() {
> Integer _integer = new Integer(0);
> return _integer.equals("foo");
> }
> }
>
> am I missing something?
>
> cheers
> Lorenzo
>
Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1433963 is a reply to message #1433959] Mon, 29 September 2014 13:22 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1815
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 29/09/2014 15:18, Sebastian Zarnekow wrote:
> Hmm obviously I'm the one who missed something. I expected it to use
> your explicitly suppressed warnings, but apparently it doesn't work.
>
> Could you please file a ticket and describe why you want to suppress the
> suppress warnings annotation?

mh... I found this one (sorry I hadn't seen that before); is this related?

https://bugs.eclipse.org/bugs/show_bug.cgi?id=363685

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1434024 is a reply to message #1433963] Mon, 29 September 2014 15:01 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Lorenzo,

yes this ticket is related to the issue at hand.

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 29.09.14 15:22, schrieb Lorenzo Bettini:
> On 29/09/2014 15:18, Sebastian Zarnekow wrote:
>> Hmm obviously I'm the one who missed something. I expected it to use
>> your explicitly suppressed warnings, but apparently it doesn't work.
>>
>> Could you please file a ticket and describe why you want to suppress the
>> suppress warnings annotation?
>
> mh... I found this one (sorry I hadn't seen that before); is this related?
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=363685
>
> cheers
> Lorenzo
>
Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1434053 is a reply to message #1434024] Mon, 29 September 2014 15:40 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1815
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 29/09/2014 17:01, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> yes this ticket is related to the issue at hand.
>
> Best,
> Sebastian

OK, then I'll add some information there

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: avoid @SuppressWarnings("all") in Xtend batch compiler [message #1436181 is a reply to message #1434053] Thu, 02 October 2014 14:17 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1815
Registered: July 2009
Location: Firenze, Italy
Senior Member
For the moment I'm using a workaround I documented here

http://www.lorenzobettini.it/2014/10/analyzing-xtend-code-with-sonarqube/

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:IJvmModelInferrer is being called for a lexically invalid model
Next Topic:Unit Test cross reference from one DSL to another DSL
Goto Forum:
  


Current Time: Sat Dec 14 01:01:14 GMT 2024

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

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

Back to the top