Skip to content

Commit

Permalink
Streamline error handling for sealed types.
Browse files Browse the repository at this point in the history
  • Loading branch information
srikanth-sankaran committed Oct 21, 2024
1 parent 99e5404 commit e5c3fcc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2550,11 +2550,15 @@ public interface IProblem {
int SealedLocalDirectSuperTypeSealed = TypeRelated + 1864;
/** @since 3.28 */
int SealedAnonymousClassCannotExtendSealedType = TypeRelated + 1865;
/** @since 3.28 */
/** @since 3.28
* @deprecated problem no longer generated
*/
int SealedSuperTypeInDifferentPackage = TypeRelated + 1866;
/** @since 3.28 */
/** @since 3.28
* @deprecated problem no longer generated
*/
int SealedSuperTypeDisallowed = TypeRelated + 1867;
/* Java15 errors - end */
/* Java17 Sealed types errors - end */

/**
* @since 3.28
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ private void checkAndSetModifiers() {
switch (modifiers & (ExtraCompilerModifiers.AccSealed | ExtraCompilerModifiers.AccNonSealed | ClassFileConstants.AccFinal)) {
case ExtraCompilerModifiers.AccSealed, ExtraCompilerModifiers.AccNonSealed, ClassFileConstants.AccFinal, ClassFileConstants.AccDefault : break;
default :
problemReporter().IllegalModifierCombinationForType(sourceType);
problemReporter().illegalModifierCombinationForType(sourceType);
break;
}
if (sourceType.isRecord()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3343,7 +3343,7 @@ public void illegalVisibilityModifierCombinationForField(ReferenceBinding type,
fieldDecl.sourceStart,
fieldDecl.sourceEnd);
}
public void IllegalModifierCombinationForType(SourceTypeBinding type) {
public void illegalModifierCombinationForType(SourceTypeBinding type) {
String[] arguments = new String[] {new String(type.sourceName())};
this.handle(
IProblem.IllegalModifierCombinationForType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1143,13 +1143,13 @@
1858 = Permitted type {0} in a named module {1} should be declared in the same module {1} of declaring type {2}
1859 = Permitted type {0} in an unnamed module should be declared in the same package {1} of declaring type {2}
1860 = Sealed class or interface lacks the permits clause and no class or interface from the same compilation unit declares {0} as its direct superclass or superinterface
1861 = An interface {0} is declared both sealed and non-sealed
###[obsolete] 1861 = An interface {0} is declared both sealed and non-sealed
1862 = An interface {0} declared as non-sealed should have a sealed direct superinterface
1863 = Permitted type {0} does not declare {1} as direct super interface
1864 = The local type {1} may not have a sealed supertype {0}
1865 = An anonymous class cannot subclass a sealed type {0}
1866 = Sealed type {2} and sub type {0} in an unnamed module should be declared in the same package {1}
1867 = Sealed type {1} cannot be super type of {0} as it is from a different package or split package or module
###[obsolete] 1866 = Sealed type {2} and sub type {0} in an unnamed module should be declared in the same package {1}
###[obsolete] 1867 = Sealed type {1} cannot be super type of {0} as it is from a different package or split package or module

# Switch Patterns - Java 21
1900 = Local variable {0} referenced from a guard must be final or effectively final
Expand Down

0 comments on commit e5c3fcc

Please sign in to comment.