### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java,v retrieving revision 1.70 diff -u -r1.70 CodeSnippetToCuMapper.java --- eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java 11 May 2011 14:58:56 -0000 1.70 +++ eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java 12 May 2011 11:38:45 -0000 @@ -143,7 +143,7 @@ } } // run() method declaration - if (this.complianceVersion >= ClassFileConstants.JDK1_6) { + if (this.complianceVersion >= ClassFileConstants.JDK1_5) { buffer.append("@Override "); //$NON-NLS-1$ } buffer.append("public void run() throws Throwable {").append(lineSeparator); //$NON-NLS-1$ #P org.eclipse.jdt.core.tests.compiler Index: src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java,v retrieving revision 1.20 diff -u -r1.20 CodeSnippetTest.java --- src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java 11 May 2011 14:58:56 -0000 1.20 +++ src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java 12 May 2011 11:38:46 -0000 @@ -57,8 +57,6 @@ defaultOptions.put(CompilerOptions.OPTION_ReportLocalVariableHiding, CompilerOptions.WARNING); defaultOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.IGNORE); defaultOptions.put(CompilerOptions.OPTION_ReportPossibleAccidentalBooleanAssignment, CompilerOptions.WARNING); - defaultOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotation, CompilerOptions.ERROR); - defaultOptions.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.ERROR); return defaultOptions; } /** @@ -911,4 +909,22 @@ this.context.setImports(new char[0][]); } } +/** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=345334 + */ +public void testBug345334() { + Map options = getCompilerOptions(); + if (this.complianceLevel == ClassFileConstants.JDK1_5) { + options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotation, CompilerOptions.ERROR); + } else if (this.complianceLevel >= ClassFileConstants.JDK1_6) { + options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotation, CompilerOptions.ERROR); + options.put(CompilerOptions.OPTION_ReportMissingOverrideAnnotationForInterfaceMethodImplementation, CompilerOptions.ERROR); + } + evaluateWithExpectedDisplayString( + options, + buildCharArray(new String[] { + "return \"SUCCESS\";\n", + }), + "SUCCESS".toCharArray()); +} }