Skip to content

Commit a0b7f6a

Browse files
authored
Merge pull request scala#10806 from lrytz/t13017
Avoid issuing deprecation in Java source file
2 parents 98d0ee2 + a7166f5 commit a0b7f6a

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
10521052
}
10531053
def adaptConstant(value: Constant): Tree = {
10541054
val sym = tree.symbol
1055-
if (sym != null && sym.isDeprecated)
1055+
if (sym != null && !context.unit.isJava && sym.isDeprecated)
10561056
context.deprecationWarning(tree.pos, sym)
10571057
tree match {
10581058
case Literal(`value`) => tree

test/files/pos/t13017/A.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
enum En {
2+
@Deprecated Um
3+
}
4+
5+
@interface Ann {
6+
En value();
7+
}
8+
9+
public class A {
10+
@Ann(En.Um)
11+
public static void te() { return; }
12+
}

test/files/pos/t13017/Test.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//> using options -Werror -Ypickle-java -deprecation
2+
3+
object Test {
4+
def t = A.te()
5+
}

0 commit comments

Comments
 (0)