Bug 421923 - Compiler Error Message for Abstract Static Method Is Wrong
Summary: Compiler Error Message for Abstract Static Method Is Wrong
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.4   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-17 20:21 EST by Will Herrmann CLA
Modified: 2022-09-24 05:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Will Herrmann CLA 2013-11-17 20:21:49 EST
Consider the following code:

=====
public abstract class AbstractStaticTest {

	public static abstract void publicTest();
	
	protected static abstract void protectedTest();
}
=====
This code cannot compile because a method cannot be both static and abstract. However, the compiler error message given by Eclipse is the following:

"The abstract method publicTest in type AbstractStaticTest can only set a visibility modifier, one of public or protected"

The compiler error for the second method is similar. This is confusing because the method is indeed public, so it appears to the user that the method ought to compile, but doesn't. Indeed, the problem is not with the visibility of the method, but rather the fact that the method is static and abstract at the same time.

I'd like to suggest that in this situation the following error message appears instead:

"The method publicTest in type AbstractStaticTest cannot be both abstract and static"

This alternative message clearly describes the reason for the compiler error and lets the user know what needs to be done in order to clear the compiler error.
Comment 1 Eclipse Genie CLA 2020-09-18 15:16:46 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Eclipse Genie CLA 2022-09-24 05:14:10 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.