This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 117055 - [60cat] wrong hints
Summary: [60cat] wrong hints
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks: 121950
  Show dependency tree
 
Reported: 2007-09-28 17:47 UTC by Unknown
Modified: 2007-11-14 23:18 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Tooltip/hint (7.29 KB, image/png)
2007-10-24 15:33 UTC, Unknown
Details
log file (59.06 KB, text/plain)
2007-10-24 15:35 UTC, Unknown
Details
/home/sasbeb/.netbeans/6.0beta2/var/cache/index/0.5/s58 (29.91 KB, application/octet-stream)
2007-10-24 18:30 UTC, Unknown
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2007-09-28 17:47:46 UTC
The editor wants to replace:

      _w = new Writer() {
         public void write(char[] cbuf, int off, int len) {}
         public void close() {}
         public void flush() {}
      };


with:
      _w = new Writer() {
         public void write(char[] cbuf, int off, int len) {}
         public void close() {}
         public void flush() {}

         public Appendable append(CharSequence csq) throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
         }

         public Appendable append(CharSequence csq, int start, int end) throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
         }

         public Appendable append(char c) throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
         }
      };


for both jdk1.5 and jdk1.6
The first is not a compile error.
Comment 1 Jan Lahoda 2007-10-01 09:56:52 UTC
Sorry, but I do not understand what exactly you see and where is the problem. Could you please describe in detail what
you see and what is the problem? Thanks.
Comment 2 Unknown 2007-10-01 14:35:56 UTC
The problem is that the editor shows an error/lightblub when I type the first code (mentioned in the defect)
I let the editor do an "autocomplete" and it fills in the second code (mentioned in the defect)

public Appendable append(CharSequence csq) throws IOException;
public Appendable append(CharSequence csq, int start, int end)throws IOException;
public Appendable append(char c) throws IOException;

are not abstract methods that need to be statisfied for java.io.Writer.

Comment 3 Max Sauer 2007-10-12 13:24:49 UTC
Sorry, I cannot reproduce your issue. For me, both Code Completion and 'Implement Abstract methods' supply write(),
flush() and close() as expected. Are you sure you're importing java.io.Writer properly?
Comment 4 Unknown 2007-10-18 18:24:54 UTC
This still happens with:
Product Version: NetBeans IDE Dev (Build 200710150000)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Linux version 2.6.22.9-slh-smp-1 running on i386; UTF-8; en_US (nb)
Userdir: /home/sasbeb/.netbeans/dev

Here is my class


package com.sas.analytics.cmp.log;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Writer;
public final class NullOutput {
   private OutputStream _os;
   private PrintStream _ps;
   private Writer _w;
   private PrintWriter _pw;
   
   private static NullOutput _no = new NullOutput();
   private NullOutput() {
      _os = new OutputStream() {public void write(int b) {}};
      _ps = new PrintStream(_os);
      _w = new Writer() {
         public void write(char[] cbuf, int off, int len) {}
         public void close() {}
         public void flush() {}
      };
      _pw = new PrintWriter(_w);
   };
   public static OutputStream getOutputStream() {return _no._os;}
   public static PrintStream getPrintStream() {return _no._ps;}
   public static Writer getOutputWriter() {return _no._w;}
   public static PrintWriter getPrintWriter() {return _no._pw;}
}
Comment 5 Unknown 2007-10-18 18:26:44 UTC
The auto complete/fix thing creates:

package com.sas.analytics.cmp.log;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Writer;
public final class NullOutput {
   private OutputStream _os;
   private PrintStream _ps;
   private Writer _w;
   private PrintWriter _pw;
   
   private static NullOutput _no = new NullOutput();
   private NullOutput() {
      _os = new OutputStream() {public void write(int b) {}};
      _ps = new PrintStream(_os);
      _w = new Writer() {
         public void write(char[] cbuf, int off, int len) {}
         public void close() {}
         public void flush() {}

         public Appendable append(CharSequence csq) throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
         }

         public Appendable append(CharSequence csq, int start, int end) throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
         }

         public Appendable append(char c) throws IOException {
            throw new UnsupportedOperationException("Not supported yet.");
         }
      };
      _pw = new PrintWriter(_w);
   };
   public static OutputStream getOutputStream() {return _no._os;}
   public static PrintStream getPrintStream() {return _no._ps;}
   public static Writer getOutputWriter() {return _no._w;}
   public static PrintWriter getPrintWriter() {return _no._pw;}
}
Comment 6 Jan Pokorsky 2007-10-23 14:37:28 UTC
Product Version: NetBeans IDE Dev (Build 071023)
Java: 1.5.0_10; Java HotSpot(TM) Client VM 1.5.0_10-b03
System: Linux version 2.6.16.27-0.9-smp running on i386; UTF-8; en_US (nb)

It works for me. The only hint it offers for

_w = new Writer() {

line is the Convert Anonymous to Inner. Even if I delete all methods of the Writer the Implement all abstract methods
hint generates

      _w = new Writer() {

            @Override
            public void write(char[] cbuf, int off, int len) throws IOException {
                throw new UnsupportedOperationException("Not supported yet.");
            }

            @Override
            public void flush() throws IOException {
                throw new UnsupportedOperationException("Not supported yet.");
            }

            @Override
            public void close() throws IOException {
                throw new UnsupportedOperationException("Not supported yet.");
            }
      };

as expected.

Closing as WORKSFORME.
Comment 7 Unknown 2007-10-23 16:06:41 UTC
I can reproduce it every single time.
Is there a log that NB produces that cen help with this?

What platform are you using this on?

Comment 8 Unknown 2007-10-23 16:14:33 UTC
..BTW I don't have a classpath environment variable set, nor gcj installed, so there shouldn't be classpath collisions.
That's where I'm hoping there's a log file.
This problem still occurs in Beta 2.
Comment 9 Jan Pokorsky 2007-10-23 20:48:16 UTC
I use my default platform jdk 1.5 but changing to jdk 1.6 has no effect.

The log you can find in /home/sasbeb/.netbeans/dev/var/log/messages.log. You can attach it here.

Could you take a screenshot when you click to error/lightbulb? There should be an editor hint name + some tooltip.

Please also check your platform in Tools/Options/Java Platform. The Classes tab should list a valid link to rt.jar. Do
you use a modified/patched rt.jar?
Comment 10 Unknown 2007-10-24 15:31:51 UTC
I use the jdk package from Debian.
I'm attaching the Platform Manager screenshot and log
And here's the output from NB help

Product Version: NetBeans IDE 6.0 Beta 2 (Build 200710212201)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b05
System: Linux version 2.6.22.9-slh-smp-1 running on i386; UTF-8; en_US (nb)
Userdir: /home/sasbeb/.netbeans/6.0beta2
Comment 11 Unknown 2007-10-24 15:33:17 UTC
Created attachment 51585 [details]
Tooltip/hint
Comment 12 Unknown 2007-10-24 15:35:51 UTC
Created attachment 51586 [details]
log file
Comment 13 Jan Pokorsky 2007-10-24 17:34:16 UTC
Really strange! Could you also attach following, please?

1. open /home/sasbeb/.netbeans/dev/var/cache/index/0.5/segments
2. find line <something>=<platform>/jre/lib/rt.jar where <platform> is the java platform used by your project (right
click on the project node Properties/Libraries/Java Platform)
3. zip content of /home/sasbeb/.netbeans/dev/var/cache/index/0.5/<something>/classes

And the last. Please install NetBeans Project Metadata Inspector in Tools/Plugins/Available Plugins tab. Then right
click on you project node and choose the Inspector Project Metadata item. It will dump the project info to the Output
window. Attach the content here as well. Thanks for your help.
Comment 14 Unknown 2007-10-24 18:29:08 UTC
s58=jar\:file\:/usr/lib/jvm/java-6-sun-1.6.0.03/jre/lib/rt.jar\!/

was the line in the segments file
(attaching th zip)
Comment 15 Unknown 2007-10-24 18:30:16 UTC
Created attachment 51604 [details]
/home/sasbeb/.netbeans/6.0beta2/var/cache/index/0.5/s58
Comment 16 Jan Pokorsky 2007-10-24 19:34:37 UTC
Thanks to Jan Lahoda I can reproduce it now. Please check your project Properties/Sources/Source/Binary Format property.
In case I use level JDK 1.4 and lower the issue occurs. The workaround should be to use higher level.
Comment 17 Unknown 2007-10-24 19:40:40 UTC
HMMM...
Thanks for the info.
Our corporate policy is to use 1.4 compatibility. :(
Comment 18 Tomas Zezula 2007-10-29 15:08:46 UTC
Checking in javac-impl.jar;
/cvs/java/source/javacimpl/external/javac-impl.jar,v  <--  javac-impl.jar
new revision: 1.16; previous revision: 1.15
done
Checking in org/netbeans/modules/java/source/TreeLoader.java;
/cvs/java/source/src/org/netbeans/modules/java/source/TreeLoader.java,v  <--  TreeLoader.java
new revision: 1.9; previous revision: 1.8
done
Checking in org/netbeans/modules/java/source/usages/Index.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/Index.java,v  <--  Index.java
new revision: 1.20; previous revision: 1.19
done
Checking in org/netbeans/modules/java/source/usages/RepositoryUpdater.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/RepositoryUpdater.java,v  <--  RepositoryUpdater.java
new revision: 1.102; previous revision: 1.101
done
Checking in org/netbeans/modules/java/source/usages/SourceAnalyser.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/SourceAnalyser.java,v  <--  SourceAnalyser.java
new revision: 1.17; previous revision: 1.16
done
Checking in org/netbeans/modules/java/source/usages/SymbolClassReader.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/SymbolClassReader.java,v  <--  SymbolClassReader.java
new revision: 1.15; previous revision: 1.14
done
Checking in org/netbeans/modules/java/source/usages/SymbolDumper.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/SymbolDumper.java,v  <--  SymbolDumper.java
new revision: 1.8; previous revision: 1.7
done
Comment 19 Tomas Zezula 2007-10-29 15:12:10 UTC
Thanks for the report, the root case of the problem was really bad - the class reader wrongly handled covariant return
types in JDK 1.4. Because the NetBeans is written in the JDK 5 no one here found this problem before. Thanks again.
Tomas
Comment 20 Tomas Zezula 2007-10-30 11:01:54 UTC
Fixes to prevent NPE from TransTypes caused by fix of this issue, see #120383:

Checking in javac-impl.jar;
/cvs/java/source/javacimpl/external/javac-impl.jar,v  <--  javac-impl.jar
new revision: 1.17; previous revision: 1.16
done
Checking in org/netbeans/modules/java/source/usages/Index.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/Index.java,v  <--  Index.java
new revision: 1.21; previous revision: 1.20
done
Checking in org/netbeans/modules/java/source/usages/SymbolDumper.java;
/cvs/java/source/src/org/netbeans/modules/java/source/usages/SymbolDumper.java,v  <--  SymbolDumper.java
new revision: 1.10; previous revision: 1.9
done
Comment 21 Unknown 2007-11-09 19:33:36 UTC
Works as advertised in rc1.
Great job.