Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Warn About Raw Types?

Reply
Thread Tools

Warn About Raw Types?

 
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      02-13-2011
I was setting up a table of tabs for a tabbed activity in Android. The
initial part of my table entry definition looks like this:

class TabParams
{
String Name;
String Title;
int IconID;
Class FrameClass;

Compiled and ran just fine. Then I noticed that “Class” is being used as a
raw type. So I changed that last line to

Class<? extends android.app.Activity> FrameClass;

There doesn’t seem to be any option in javac to warn about this sort of
thing.
 
Reply With Quote
 
 
 
 
Daniele Futtorovic
Guest
Posts: n/a
 
      02-13-2011
On 14/02/2011 00:21, Lawrence D'Oliveiro allegedly wrote:
> I was setting up a table of tabs for a tabbed activity in Android. The
> initial part of my table entry definition looks like this:
>
> class TabParams
> {
> String Name;
> String Title;
> int IconID;
> Class FrameClass;
>
> Compiled and ran just fine. Then I noticed that Class is being used as a
> raw type. So I changed that last line to
>
> Class<? extends android.app.Activity> FrameClass;
>
> There doesnt seem to be any option in javac to warn about this sort of
> thing.


Epic fail.

 
Reply With Quote
 
 
 
 
Stanimir Stamenkov
Guest
Posts: n/a
 
      02-14-2011
Mon, 14 Feb 2011 12:21:34 +1300, /Lawrence D'Oliveiro/:

> Compiled and ran just fine. Then I noticed that “Class” is being used as a
> raw type. So I changed that last line to
>
> Class<? extends android.app.Activity> FrameClass;
>
> There doesn’t seem to be any option in javac to warn about this sort of
> thing.


Have you tried:

% javac
Usage: javac <options> <source files>
where possible options include:
...
-X Print a synopsis of nonstandard options

% javac -X
-Xlint Enable recommended warnings
-Xlint:{all,cast,deprecation,divzero,empty,unchecke d,fallthrough,path,serial,finally,overrides,-cast,-deprecation,-divzero,-empty,
-unchecked,-fallthrough,-path,-serial,-finally,-overrides,none}Enable or disable specific warnings
...

--
Stanimir
 
Reply With Quote
 
markspace
Guest
Posts: n/a
 
      02-14-2011
On 2/13/2011 3:21 PM, Lawrence D'Oliveiro wrote:
> I was setting up a table of tabs for a tabbed activity in Android. The
> initial part of my table entry definition looks like this:
>
> class TabParams
> {
> String Name;
> String Title;
> int IconID;
> Class FrameClass;
>
> Compiled and ran just fine. Then I noticed that “Class” is being used as a
> raw type. So I changed that last line to
>
> Class<? extends android.app.Activity> FrameClass;
>
> There doesn’t seem to be any option in javac to warn about this sort of
> thing.



Try this:

<http://lmgtfy.com/?q=javac+raw+type>


Third one down on my results list.




 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      02-14-2011
In message <ij9roa$oi1$(E-Mail Removed)-september.org>, Stanimir Stamenkov wrote:

> Mon, 14 Feb 2011 12:21:34 +1300, /Lawrence D'Oliveiro/:
>
>> Compiled and ran just fine. Then I noticed that “Class” is being used as
>> a raw type.
>>
>> There doesn’t seem to be any option in javac to warn about this sort of
>> thing.

>
> Have you tried:
>
> % javac
> Usage: javac <options> <source files>
> where possible options include:
> ...
> -X Print a synopsis of nonstandard options
>
> % javac -X
> -Xlint Enable recommended warnings
> -Xlint:{all,cast,deprecation,divzero,empty,unchecke d,fallthrough,path,serial,finally,overrides,-cast,-deprecation,-divzero,-empty,
> -unchecked,-fallthrough,-path,-serial,-finally,-overrides,none}Enable or
> disable specific warnings


ldo@theon:java_try> cat test.java
class test
{
public static void main(String[] args)
{
Class s = String.class;
} /*main*/
}
ldo@theon:java_try> javac -Xlint test.java
ldo@theon:java_try> javac -Xlint:deprecation test.java
ldo@theon:java_try> javac -Xlint:all test.java
ldo@theon:java_try>

No warnings.

Any other suggestions?
 
Reply With Quote
 
markspace
Guest
Posts: n/a
 
      02-14-2011
On 2/13/2011 5:06 PM, Lawrence D'Oliveiro wrote:

> ldo@theon:java_try> javac -Xlint test.java
> ldo@theon:java_try> javac -Xlint:all test.java
> ldo@theon:java_try>
>
> No warnings.
>
> Any other suggestions?



I gotta admit, I thought these would work. There's some documentation
on the web that seems to indicate it should. But it didn't work for me
either.

 
Reply With Quote
 
Lawrence D'Oliveiro
Guest
Posts: n/a
 
      02-14-2011
In message <ijac7q$r7p$(E-Mail Removed)-september.org>, markspace wrote:

> On 2/13/2011 5:06 PM, Lawrence D'Oliveiro wrote:
>
>> ldo@theon:java_try> javac -Xlint test.java
>> ldo@theon:java_try> javac -Xlint:all test.java
>> ldo@theon:java_try>
>>
>> No warnings.
>>
>> Any other suggestions?

>
> I gotta admit, I thought these would work.


Yeah, all these ****ing stupid idiots shooting their mouth off as though
they really knew something I didn’t...
 
Reply With Quote
 
Arved Sandstrom
Guest
Posts: n/a
 
      02-14-2011
On 11-02-14 12:48 AM, markspace wrote:
> On 2/13/2011 5:06 PM, Lawrence D'Oliveiro wrote:
>
>> ldo@theon:java_try> javac -Xlint test.java
>> ldo@theon:java_try> javac -Xlint:all test.java
>> ldo@theon:java_try>
>>
>> No warnings.
>>
>> Any other suggestions?

>
>
> I gotta admit, I thought these would work. There's some documentation on
> the web that seems to indicate it should. But it didn't work for me either.
>

Another useful article:
http://blogs.sun.com/mcimadamore/ent...sing_raw_types. Somewhat
dated but I think still largely relevant to this discussion.

It's perhaps worth noting that if working inside Eclipse that the IDE
will flag certain raw type usages that are labelled as "harmless" in
that article (Preferences / Java / Compiler / Errors and Warnings /
Generic types / Usage of a raw type)

Pursuant to the article above I think it's actually JDK 7 that
introduces the -Xlint:rawtypes option. With OpenJDK 6 or Sun jdk 6 you'd
just have to be somewhat knowledgeable about what you're doing...tall
order for some characters no doubt.

AHS
--
We must recognize the chief characteristic of the modern era - a
permanent state of what I call violent peace.
-- James D. Watkins
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      02-14-2011
Arved Sandstrom wrote:
> Another useful article:
> http://blogs.sun.com/mcimadamore/ent...sing_raw_types. Somewhat dated
> but I think still largely relevant to this discussion.
>
> It's perhaps worth noting that if working inside Eclipse that the IDE will
> flag certain raw type usages that are labelled as "harmless" in that article
> (Preferences / Java / Compiler / Errors and Warnings / Generic types / Usage
> of a raw type)
>
> Pursuant to the article above I think it's actually JDK 7 that introduces the
> -Xlint:rawtypes option. With OpenJDK 6 or Sun jdk 6 you'd just have to be
> somewhat knowledgeable about what you're doing...tall order for some
> characters no doubt.


God forbid that we should require programmers to be somewhat knowledgeable
about what they're doing!

Every time that's suggested in this group you get a lot of squeaky pushback.
"Oh, you're just a JLS lawyer!" (Is that a bad thing?) "No one should be
expected to know the entire 'String' interface!" "The ternary operator is too
confusing!" (And that's just from people who know what "ternary operator"
means - the usual complaint is, "The question-mark operator is too
confusing!") "I don't really need to synchronize access, do I?" "What's an
API doc?"

--
Lew
Honi soit qui mal y pense.
 
Reply With Quote
 
markspace
Guest
Posts: n/a
 
      02-14-2011
On 2/13/2011 10:19 PM, Lawrence D'Oliveiro wrote:

>
> Yeah, all these ****ing stupid idiots shooting their mouth off as though
> they really knew something I didn’t...



To be fair to them, the last three posts you've made in this forum were
pretty ****ing retarded. I guess everyone just assumed that the ****ing
retard boy was just crying ****ing wolf again.

In other news, even a broken clock is right twice a day.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Warn user before leaving page with unsaved changes markalroberts@gmail.com ASP .Net 7 02-28-2011 08:37 PM
'Warn on close when more than one tab is open' not working NoMoreMrNiceGuy Firefox 1 11-20-2005 02:35 AM
how to warn? Jason L. Woodruff Perl 1 09-10-2004 05:45 AM
How can I warn a user they are about to navigate away from a page Tone Curtis ASP .Net 3 06-10-2004 07:19 AM
Trace.Warn Elmo Watson ASP .Net 0 10-29-2003 06:54 PM



Advertisments