Bug 489878 - Compilation error in AddManifestEntryTaskWizard
Summary: Compilation error in AddManifestEntryTaskWizard
Status: RESOLVED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.common (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: Carl Anderson CLA
QA Contact: Carl Anderson CLA
URL:
Whiteboard:
Keywords:
Depends on: 487940
Blocks:
  Show dependency tree
 
Reported: 2016-03-17 14:17 EDT by Vaninder Rajput CLA
Modified: 2016-03-18 10:04 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vaninder Rajput CLA 2016-03-17 14:17:56 EDT
WTP 3.8.0- builds just failed with the following error. 

Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.21.0:compile (default-compile) on project org.eclipse.jst.common.ui: Compilation failure: Compilation failure:
[ERROR] /jobs/genie.webtools/WTP-R3_8_Integration/workspace/webtools.common/plugins/org.eclipse.jst.common.ui/src/org/eclipse/jst/common/ui/internal/assembly/wizard/AddManifestEntryTaskWizard.java:[230]
[ERROR] public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The method inputChanged(Viewer, Object, Object) of type AddManifestEntryTaskWizard.ShowPossibleManifestEntryContentProvider must override a superclass method

This is a blocker for M6 candidate. Please take a look at it asap. 

thanks
Comment 1 Carl Anderson CLA 2016-03-17 15:22:49 EDT
So our plugin does not use Java 8 to compile.  ArrayContentProvider.inputChanged() was removed because it's interface, IContentProvider, now has:

default public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}

The default keyword on an interface is new to Java 8, and does not seem to work with the @Override on our method.
Comment 2 Carl Anderson CLA 2016-03-17 15:34:46 EDT
This is confusing- the docs state that when default is used in an interface, @Override is not needed to override... which is just the opposite of why @Override was put there in the first place.  So it is either:

1) Get Platform UI to make a compatible change to ArrayContentProvider

or

2) Remove the now "extraneous" @Override in our code (which means that our source has to change to still compile with the "compatible" change in ArrayContentProvider
Comment 3 Dani Megert CLA 2016-03-17 16:44:17 EDT
Looks like you are violating the API here. ArrayContentProvider says:

@noextend This class is not intended to be subclassed by clients.
Comment 4 Carl Anderson CLA 2016-03-17 17:35:13 EDT
(In reply to Dani Megert from comment #3)
> Looks like you are violating the API here. ArrayContentProvider says:
> 
> @noextend This class is not intended to be subclassed by clients.

Dani,

Was it marked as such 6 years ago?  (That's when our class was created, and it hasn't been touched in over 5 years.)

OK, so simply put, that makes it our duty to remove the compile error.  I will commit a change to fix it.
Comment 5 Markus Keller CLA 2016-03-18 09:39:56 EDT
@Override has a troubled history, see bug 392931:
- In 1.5, @Override was only allowed on methods overriding a superclass method.
- In 1.6, @Override was also allowed on methods overriding or implementing an interface method. However, the Javadoc of the @interface Override was not fixed.
- In 1.7, they finally fixed the Javadoc as well.

This is only a source compatibility problem for 1.5 clients. An alternative to http://git.eclipse.org/c/webtools-common/webtools.common.git/commit/?id=e53db74702dce1a3398d44a73845bd70f1e56139 would have been to keep the @Override, but convert your bundle to 1.6.
Comment 6 Markus Keller CLA 2016-03-18 10:04:08 EDT
I was a bit too quick. This is actually a "bug" in ecj: bug 489940.

I put "bug" in quotes because there's no specification for compiling 1.5 source against a 1.8 classpath, so compiler implementors are on their own to find a good solution for such use cases.