Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2011 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 23-28
Link Here
|
23 |
import org.eclipse.core.runtime.CoreException; |
23 |
import org.eclipse.core.runtime.CoreException; |
24 |
import org.eclipse.core.runtime.IProgressMonitor; |
24 |
import org.eclipse.core.runtime.IProgressMonitor; |
25 |
import org.eclipse.jdt.core.*; |
25 |
import org.eclipse.jdt.core.*; |
|
|
26 |
import org.eclipse.jdt.core.compiler.IProblem; |
27 |
import org.eclipse.jdt.core.dom.AST; |
28 |
import org.eclipse.jdt.core.dom.ASTParser; |
26 |
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; |
29 |
import org.eclipse.jdt.core.dom.rewrite.ImportRewrite; |
27 |
import org.eclipse.jdt.internal.core.Buffer; |
30 |
import org.eclipse.jdt.internal.core.Buffer; |
28 |
import org.eclipse.jdt.internal.core.CompilationUnit; |
31 |
import org.eclipse.jdt.internal.core.CompilationUnit; |
Lines 478-483
Link Here
|
478 |
} |
481 |
} |
479 |
|
482 |
|
480 |
/* |
483 |
/* |
|
|
484 |
* Bug 337868 - [compiler][model] incomplete support for package-info.java when using SearchableEnvironment |
485 |
* Ensure that package level annotation is evaluated during AST creation. |
486 |
*/ |
487 |
public void testDeprecatedFlag10() throws CoreException { |
488 |
createFolder("/P/src/p2"); |
489 |
|
490 |
createFile( |
491 |
"/P/src/p2/package-info.java", |
492 |
"@java.lang.Deprecated package p2;\n" |
493 |
); |
494 |
|
495 |
// workaround for missing type in jclMin: |
496 |
createFolder("/P/src/java/lang"); |
497 |
createFile( |
498 |
"/P/src/java/lang/Deprecated.java", |
499 |
"package java.lang;\n" + |
500 |
"@Retention(RetentionPolicy.RUNTIME)\n" + |
501 |
"public @interface Deprecated {\n" + |
502 |
"}\n" |
503 |
); |
504 |
|
505 |
createFile("/P/src/p2/C.java", |
506 |
"package p2;\n" + |
507 |
"public class C {}\n"); |
508 |
|
509 |
createFile("/P/src/p/D.java", |
510 |
"package p;\n" + |
511 |
"public class D extends p2.C {}\n"); |
512 |
ICompilationUnit cuD = getCompilationUnit("/P/src/p/D.java"); |
513 |
|
514 |
ASTParser parser = ASTParser.newParser(AST.JLS3); |
515 |
parser.setProject(this.testProject); |
516 |
parser.setSource(cuD); |
517 |
parser.setResolveBindings(true); |
518 |
org.eclipse.jdt.core.dom.CompilationUnit cuAST = (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(null); |
519 |
IProblem[] problems = cuAST.getProblems(); |
520 |
assertEquals("Should have 1 problem", 1, problems.length); |
521 |
assertEquals("Should have a deprecation warning", "The type C is deprecated", problems[0].getMessage()); |
522 |
} |
523 |
/* |
481 |
* Ensures that the primary type of a cu can be found. |
524 |
* Ensures that the primary type of a cu can be found. |
482 |
*/ |
525 |
*/ |
483 |
public void testFindPrimaryType1() throws JavaModelException { |
526 |
public void testFindPrimaryType1() throws JavaModelException { |