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 163698 - Create class hint could infer type
Summary: Create class hint could infer type
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Svata Dedic
Depends on:
Reported: 2009-04-27 01:45 UTC by _ tboudreau
Modified: 2013-09-02 14:19 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2009-04-27 01:45:34 UTC
Say you have 

public enum Foo {
  public Bar getBar() {
    switch(this) {
      case A :
        return new A_Bar();
      case B :
        return new B_Bar();
      default :
        throw new AssertionError("" + this);
  interface Bar() {}
  class A_Bar implements Bar {}

The line 
return new B_Bar();
will give you a create class hint.

We know the return type of getBar() is Bar.  But the class generated if you accept the hint is
public class B_Bar {
  public B_Bar() {

Two things could improve the result:
1.  It could be 
public class B_Bar implements Bar

2.  If Bar is package private, make the generated class and constructor package-private too.
Comment 1 Max Sauer 2009-04-27 10:24:01 UTC
Definitely. Thanks for your ideas.