Bug Tracker item #3418258, was opened at 2011-10-04 02:17
Message generated for change (Comment added) made by dcommander
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126848&aid=3418258&group_id=254363

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Java viewer
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: D. R. Commander (dcommander)
Assigned to: Brian Hinz (bphinz)
Summary: New Java viewer produces tons of warnings under OpenJDK

Initial Comment:
When building our new Java viewer using OpenJDK (the default Java environment 
on RHEL 5 and many newer distros of Linux), about 75 warnings are generated.  
These are mostly innocuous things such as unused imports, but they should 
really be cleaned up.


----------------------------------------------------------------------

>Comment By: D. R. Commander (dcommander)
Date: 2011-10-12 15:35

Message:
Confirmed that using the real OpenJDK fixes this.  I was confused because
java-1.6.0-openjdk was installed, but you actually have to install
java-1.6.0-openjdk-devel in order to get the OpenJDK version of javac.

I guess it would be nice if we could enable the "useful" warnings
regarding code cleanliness somehow in the linter, but that doesn't appear
to be possible.  Thus, I'm closing this as fixed.


----------------------------------------------------------------------

Comment By: Brian Hinz (bphinz)
Date: 2011-10-08 22:02

Message:
Agreed, I'm actually going through them now.

----------------------------------------------------------------------

Comment By: D. R. Commander (dcommander)
Date: 2011-10-08 21:58

Message:
I'm not in front of my machine where I can confirm this, but in any case,
some of the warnings were useful. The warnings about accessing static
members in non-static ways pointed to code that is possibly not doing what
it was intended to do.

----------------------------------------------------------------------

Comment By: Brian Hinz (bphinz)
Date: 2011-10-08 20:34

Message:
Or...  It's not OpenJDK:

[bphinz@localhost ~]$ ls -l /usr/bin/javac 
lrwxrwxrwx 1 root root 23 Oct  8 10:05 /usr/bin/javac ->
/etc/alternatives/javac
[bphinz@localhost ~]$ ls -l /etc/alternatives/javac
lrwxrwxrwx 1 root root 37 Oct  8 10:05 /etc/alternatives/javac ->
/usr/lib/jvm/java-1.4.2-gcj/bin/javac

'alternatives -config javac' and set it to openjdk and the linter reports
only the same 19 warnings as it does on natty.

----------------------------------------------------------------------

Comment By: Brian Hinz (bphinz)
Date: 2011-10-08 19:53

Message:
That is nuts!  OpenJDK on EL5 produces 147 warnings, compared to 19 on
Ubuntu 11.04.   I'll get cracking on cleaning those up.  Thanks

----------------------------------------------------------------------

Comment By: D. R. Commander (dcommander)
Date: 2011-10-06 02:24

Message:
As I look at these more closely, some of the warnings concern me.  For
instance, I am getting warnings regarding using static methods and members
in non-static ways.  I think that, for instance, you don't really intend
for Screen.id, Screen.dimensions, and Screen.flags to be static.

Not sure why Oracle JDK isn't producing these same warnings with
-Xlint:all

If you're using OpenJDK, try adding

  -nowarn -warn:+staticReceiver,unusedImport,unusedLocal,unusedPrivate

to your javac command line.  That should give you the exact set of
warnings that I'm seeing.


----------------------------------------------------------------------

Comment By: D. R. Commander (dcommander)
Date: 2011-10-05 14:15

Message:
Re-opening because, unfortunately, -Xlint:all,-serial,-cast seems to be
ignored by the version of OpenJDK I'm using (on RHEL 5.)  It doesn't
decrease the warnings at all, nor does r4694.


----------------------------------------------------------------------

Comment By: Brian Hinz (bphinz)
Date: 2011-10-04 18:56

Message:
Just committed change r4694, which should clean up some of these warnings,
but I still don't see anywhere near the same number of warnings.  I don't
know if this is a difference between what's enabled on 1.6.0_22 (Ubuntu
11.04) and RHEL5 or not.  I'll have to load up a RHEL5 vm to test it.

Also, I set the linter flags to filter out serial and cast warnings, let
me know if you disagree with this and I can revert that.

----------------------------------------------------------------------

Comment By: D. R. Commander (dcommander)
Date: 2011-10-04 13:15

Message:
It happens irrespective of the build system.  I can simply do:

cd tigervnc/java/src
javac -1.5 -cp . com/tigervnc/vncviewer/*.java

and get 152 warnings, of which about half are from the VncViewer code (the
other half from JZlib.)  These are the warnings it enables by default on
RHEL 5:

      assertIdentifier   + 'assert' used as identifier
      charConcat         + char[] in String concat
      constructorName    + method with constructor name
      deprecation        + deprecation outside deprecated code
      discouraged        + use of types matching a discouraged access
rule
      finally            + finally block not completing normally
      forbidden          + use of types matching a forbidden access rule
      intfAnnotation     + annotation type used as super interface
      intfNonInherited   + interface non-inherited method compatibility
      maskedCatchBlock   + hidden catch block
      noEffectAssign     + assignment without effect
      pkgDefaultMethod   + attempt to override package-default method
      serial             + missing serialVersionUID
      staticReceiver     + non-static reference to static member
      suppress           + enable @SuppressWarnings
      typeHiding         + type parameter hiding another type
      unchecked          + unchecked type operation
      unusedImport       + unused import declaration
      unusedLabel        + unused label
      unusedLocal        + unread local variable
      unusedPrivate      + unused private member declaration
      varargsCast        + varargs argument need explicit cast
      warningToken       + unhandled warning token in @SuppressWarnings


----------------------------------------------------------------------

Comment By: Brian Hinz (bphinz)
Date: 2011-10-04 05:24

Message:
Is this before or after the cmake integration?  I've been using OpenJDK for
quite a while and don't get any warnings with the pre-cmake build.  With
-Xlint, I do see 63 warnings, but > half are in JZlib, which I would prefer
not to change.  The others I'll work on.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1126848&aid=3418258&group_id=254363

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Tigervnc-devel mailing list
Tigervnc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-devel

Reply via email to