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 197445 - Inherited main
Summary: Inherited main
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 6.x
Hardware: PC Other
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-05 14:52 UTC by Xypron
Modified: 2011-04-12 08:41 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xypron 2011-04-05 14:52:04 UTC
Given two classes

public class C1 {
 public static void main(String[] args) {
   System.out.println(this.getClass());
 }
}

public class C2 extends C1 {
}

the IDE does not identify C2 as an executable class though it
can be run from the console with

java --classpath=. C2

because C2 inherits the main method from C1.

Best regards

Xypron
Comment 1 Tomas Zezula 2011-04-05 16:44:03 UTC
It's a corner case.

>because C2 inherits the main method from C1
In fact it's not inherited as it's static, it's only in scope of.

You can set it to be a main in Project properties/Run/Main Class. You will need to type it by hand, it's not available in selection as it has no main method - and this is desired behavior.
But I can change the "Run File" action to allow such a class to be executed as in case of run project (it's allowed there).
Comment 2 Tomas Zezula 2011-04-11 14:54:44 UTC
Fixed jet-main 192e9324510f
Comment 3 Quality Engineering 2011-04-12 08:41:31 UTC
Integrated into 'main-golden', will be available in build *201104120401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/192e9324510f
User: Tomas Zezula <tzezula@netbeans.org>
Log: #197445:Inherited main