@@ -998,7 +998,7 @@ private boolean matchesAlternateMessage(String original, String expected, int pr
998998 return m ;
999999 case IProblem .JavadocMissingParamTag :
10001000 return original .replace ("no @param for " , "Javadoc: Missing tag for parameter " ).equals (expected );
1001- case IProblem .UncheckedAccessOfValueOfFreeTypeVariable :
1001+ case IProblem .UncheckedAccessOfValueOfFreeTypeVariable : {
10021002 String p = "Type safety: The expression of type (.*) needs unchecked conversion to conform to (.*)" ;
10031003 Pattern r = Pattern .compile (p );
10041004 Matcher m1 = r .matcher (expected );
@@ -1012,6 +1012,25 @@ private boolean matchesAlternateMessage(String original, String expected, int pr
10121012 }
10131013 }
10141014 return false ;
1015+ }
1016+ case IProblem .UnsafeGenericCast : {
1017+ String p = "Type safety: Unchecked cast from (.*) to (.*)" ;
1018+ Pattern r = Pattern .compile (p );
1019+ Matcher m1 = r .matcher (expected );
1020+ if (m1 .find ( )) {
1021+ String g0 = m1 .group (1 ).replaceAll ("capture#([0-9]*)-" , "capture#$1 " );
1022+ String g1 = m1 .group (2 ).replaceAll ("capture#([0-9]*)-" , "capture#$1 " );
1023+ String originalToSimple = original
1024+ .replaceAll ("java\\ .lang\\ ." , "" )
1025+ .replaceAll ("java\\ .util\\ ." , "" );
1026+ String found = "unchecked cast\n required: *" + g1 + "\n found: *" + g0 ;
1027+ found = found .replaceAll ("\\ ?" , "\\ \\ ?" );
1028+ if ( originalToSimple .replaceAll (found , "" ).equals ("" )) {
1029+ return true ;
1030+ }
1031+ }
1032+ return false ;
1033+ }
10151034 case IProblem .DuplicateMethod : // TODO these should really be fixed elsewhere
10161035 if ( expected .startsWith ("Duplicate local variable " )) {
10171036 return original .startsWith (expected .substring (16 ) + " is already defined" );
0 commit comments