@@ -131,7 +131,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
131
131
* (`owner` tells where the type occurs).
132
132
*/
133
133
def privates [T <: Tree ](typer : Typer , owner : Symbol , tree : T ): T =
134
- check(typer, owner, EmptyScope , WildcardType , tree)
134
+ if (owner.isJavaDefined) tree else check(typer, owner, EmptyScope , WildcardType , tree)
135
135
136
136
private def check [T <: Tree ](typer : Typer , owner : Symbol , scope : Scope , pt : Type , tree : T ): T = {
137
137
this .owner = owner
@@ -1759,7 +1759,9 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
1759
1759
checkStablePrefixClassType(parent)
1760
1760
1761
1761
if (psym != superclazz) {
1762
- if (psym.isTrait) {
1762
+ if (context.unit.isJava && context.unit.isJava && psym.isJavaAnnotation) {
1763
+ // allowed
1764
+ } else if (psym.isTrait) {
1763
1765
val ps = psym.info.parents
1764
1766
if (! ps.isEmpty && ! superclazz.isSubClass(ps.head.typeSymbol))
1765
1767
pending += ParentSuperSubclassError (parent, superclazz, ps.head.typeSymbol, psym)
@@ -1845,7 +1847,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
1845
1847
if (clazz.isTrait && clazz.info.parents.nonEmpty && clazz.info.firstParent.typeSymbol == AnyClass )
1846
1848
checkEphemeral(clazz, impl2.body)
1847
1849
1848
- if ((clazz isNonBottomSubClass ClassfileAnnotationClass ) && (clazz != ClassfileAnnotationClass )) {
1850
+ if (! clazz.isJavaDefined && (clazz isNonBottomSubClass ClassfileAnnotationClass ) && (clazz != ClassfileAnnotationClass )) {
1849
1851
if (! clazz.owner.isPackageClass)
1850
1852
context.error(clazz.pos, " inner classes cannot be classfile annotations" )
1851
1853
// Ignore @SerialVersionUID, because it is special-cased and handled completely differently.
@@ -2008,7 +2010,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
2008
2010
if (clazz.isTrait && hasSuperArgs(parents1.head))
2009
2011
ConstrArgsInParentOfTraitError (parents1.head, clazz)
2010
2012
2011
- if ((clazz isSubClass ClassfileAnnotationClass ) && ! clazz.isTopLevel)
2013
+ if (! clazz.isJavaDefined && (clazz isSubClass ClassfileAnnotationClass ) && ! clazz.isTopLevel)
2012
2014
context.error(clazz.pos, " inner classes cannot be classfile annotations" )
2013
2015
2014
2016
if (! phase.erasedTypes && ! clazz.info.resultType.isError) // @S: prevent crash for duplicated type members
0 commit comments