Skip to content
Snippets Groups Projects

Fix javac-21 compiler warnings

Files
3
+ 50
0
--- a/javacutil/src/main/java/org/checkerframework/javacutil/trees/TreeBuilder.java
+++ b/javacutil/src/main/java/org/checkerframework/javacutil/trees/TreeBuilder.java
@@ -71,6 +71,7 @@
* @param iterableExpr an expression whose type is a subtype of Iterable
* @return a MemberSelectTree that accesses the iterator() method of the expression
*/
+ @SuppressWarnings("cast")
public MemberSelectTree buildIteratorMethodAccess(ExpressionTree iterableExpr) {
DeclaredType exprType =
(DeclaredType) TypesUtils.upperBound(TreeUtils.typeOf(iterableExpr));
@@ -140,6 +141,7 @@
* @param iteratorExpr an expression whose type is a subtype of Iterator
* @return a MemberSelectTree that accesses the hasNext() method of the expression
*/
+ @SuppressWarnings("cast")
public MemberSelectTree buildHasNextMethodAccess(ExpressionTree iteratorExpr) {
DeclaredType exprType = (DeclaredType) TreeUtils.typeOf(iteratorExpr);
assert exprType != null : "expression must be of declared type Iterator<>";
@@ -176,6 +178,7 @@
* @param iteratorExpr an expression whose type is a subtype of Iterator
* @return a MemberSelectTree that accesses the next() method of the expression
*/
+ @SuppressWarnings("cast")
public MemberSelectTree buildNextMethodAccess(ExpressionTree iteratorExpr) {
DeclaredType exprType = (DeclaredType) TreeUtils.typeOf(iteratorExpr);
assert exprType != null : "expression must be of declared type Iterator<>";
@@ -231,6 +234,7 @@
* @param expression the array expression whose length is being accessed
* @return a MemberSelectTree to dereference the length of the array
*/
+ @SuppressWarnings("cast")
public MemberSelectTree buildArrayLengthAccess(ExpressionTree expression) {
return (JCTree.JCFieldAccess)
@@ -404,6 +408,7 @@
* @param expr an expression whose type is a boxed type
* @return a MemberSelectTree that accesses the valueOf() method of the expression
*/
+ @SuppressWarnings("cast")
public MemberSelectTree buildValueOfMethodAccess(Tree expr) {
TypeMirror boxedType = TreeUtils.typeOf(expr);
@@ -453,6 +458,7 @@
* @param expr an expression whose type is a boxed type
* @return a MemberSelectTree that accesses the *Value() method of the expression
*/
+ @SuppressWarnings("cast")
public MemberSelectTree buildPrimValueMethodAccess(Tree expr) {
TypeMirror boxedType = TreeUtils.typeOf(expr);
TypeElement boxedElement = (TypeElement) ((DeclaredType) boxedType).asElement();
Loading