summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/xml/xpath/XPathParser.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/gnu/xml/xpath/XPathParser.java')
-rw-r--r--libjava/classpath/gnu/xml/xpath/XPathParser.java88
1 files changed, 50 insertions, 38 deletions
diff --git a/libjava/classpath/gnu/xml/xpath/XPathParser.java b/libjava/classpath/gnu/xml/xpath/XPathParser.java
index 9b7540a4a40..e8c8e94da79 100644
--- a/libjava/classpath/gnu/xml/xpath/XPathParser.java
+++ b/libjava/classpath/gnu/xml/xpath/XPathParser.java
@@ -79,7 +79,7 @@ public class XPathParser
return qName;
}
- Expr lookupFunction(String name, List args)
+ Expr lookupFunction(String name, List<Expr> args)
{
int arity = args.size();
if ("position".equals(name) && arity == 0)
@@ -491,7 +491,7 @@ case 5:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
+ steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(new Root());
yyVal = steps;
@@ -512,7 +512,7 @@ case 6:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
+ steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(s);
steps.path.addFirst(new Root());
@@ -532,9 +532,9 @@ case 8:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[-2+yyTop]);
+ steps.path.addFirst((Expr) yyVals[-2+yyTop]);
}
- steps.path.addLast(yyVals[0+yyTop]);
+ steps.path.addLast((Expr) yyVals[0+yyTop]);
yyVal = steps;
/*$$ = new Step((Expr) $1, (Path) $3);*/
}
@@ -553,10 +553,10 @@ case 9:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[-2+yyTop]);
+ steps.path.addFirst((Expr) yyVals[-2+yyTop]);
}
steps.path.addLast(s);
- steps.path.addLast(yyVals[0+yyTop]);
+ steps.path.addLast((Expr) yyVals[0+yyTop]);
yyVal = steps;
/*Step step = new Step(s, (Path) $3);*/
/*$$ = new Step((Expr) $1, step);*/
@@ -565,48 +565,56 @@ case 9:
case 10:
// line 362 "XPathParser.y"
{
- yyVal = new Selector (Selector.CHILD, (List) yyVals[0+yyTop]);
- }
+ @SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
+ yyVal = new Selector (Selector.CHILD, tests);
+ }
break;
case 11:
// line 366 "XPathParser.y"
{
- yyVal = new Selector (Selector.ATTRIBUTE, (List) yyVals[0+yyTop]);
- }
+ /* This is safe as we create this in one of the other cases */
+ @SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
+ yyVal = new Selector (Selector.ATTRIBUTE, tests);
+ }
break;
case 12:
// line 370 "XPathParser.y"
{
- yyVal = new Selector (((Integer) yyVals[-2+yyTop]).intValue (), (List) yyVals[0+yyTop]);
- }
+ /* This is safe as we create this in one of the other cases */
+ @SuppressWarnings("unchecked") List<Test> tests = (List<Test>) yyVals[0+yyTop];
+ yyVal = new Selector (((Integer) yyVals[-2+yyTop]).intValue (), tests);
+ }
break;
case 13:
// line 374 "XPathParser.y"
{
- yyVal = new Selector (Selector.SELF, Collections.EMPTY_LIST);
- }
+ List<Test> emptyList = Collections.emptyList();
+ yyVal = new Selector (Selector.SELF, emptyList);
+ }
break;
case 14:
// line 378 "XPathParser.y"
{
- yyVal = new Selector (Selector.PARENT, Collections.EMPTY_LIST);
- }
+ List<Test> emptyList = Collections.emptyList();
+ yyVal = new Selector (Selector.PARENT, emptyList);
+ }
break;
case 15:
// line 385 "XPathParser.y"
{
- List list = new ArrayList();
- list.add(yyVals[0+yyTop]);
+ List<Test> list = new ArrayList<Test>();
+ list.add((Test) yyVals[0+yyTop]);
yyVal = list;
}
break;
case 16:
// line 391 "XPathParser.y"
{
- List list = (List)yyVals[-1+yyTop];
- list.add(yyVals[0+yyTop]);
- yyVal = list;
- }
+ /* This is safe as we create this in one of the other cases */
+ @SuppressWarnings("unchecked") List<Test> tests = (List<Test>)yyVals[-1+yyTop];
+ tests.add((Test) yyVals[0+yyTop]);
+ yyVal = tests;
+ }
break;
case 17:
// line 415 "XPathParser.y"
@@ -725,30 +733,34 @@ case 37:
case 39:
// line 508 "XPathParser.y"
{
- yyVal = lookupFunction((String) yyVals[-2+yyTop], Collections.EMPTY_LIST);
- }
+ List<Expr> emptyList = Collections.emptyList();
+ yyVal = lookupFunction((String) yyVals[-2+yyTop], emptyList);
+ }
break;
case 40:
// line 512 "XPathParser.y"
{
- yyVal = lookupFunction((String) yyVals[-3+yyTop], (List) yyVals[-1+yyTop]);
- }
+ /* This is safe as we create this below */
+ @SuppressWarnings("unchecked") List<Expr> exprs = (List<Expr>) yyVals[-1+yyTop];
+ yyVal = lookupFunction((String) yyVals[-3+yyTop], exprs);
+ }
break;
case 41:
// line 519 "XPathParser.y"
{
- List list = new ArrayList();
- list.add(yyVals[0+yyTop]);
+ List<Expr> list = new ArrayList<Expr>();
+ list.add((Expr) yyVals[0+yyTop]);
yyVal = list;
}
break;
case 42:
// line 525 "XPathParser.y"
{
- List list = (List) yyVals[0+yyTop];
- list.add(0, yyVals[-2+yyTop]);
- yyVal = list;
- }
+ /* This is safe as we create this above */
+ @SuppressWarnings("unchecked") List<Expr> list = (List<Expr>) yyVals[0+yyTop];
+ list.add(0, (Expr) yyVals[-2+yyTop]);
+ yyVal = list;
+ }
break;
case 44:
// line 535 "XPathParser.y"
@@ -767,9 +779,9 @@ case 47:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
+ steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
- steps.path.addFirst(yyVals[-2+yyTop]);
+ steps.path.addFirst((Expr) yyVals[-2+yyTop]);
yyVal = steps;
/*$$ = new Step ((Expr) $1, (Path) $3);*/
}
@@ -788,10 +800,10 @@ case 48:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[0+yyTop]);
+ steps.path.addFirst((Expr) yyVals[0+yyTop]);
}
steps.path.addFirst(s);
- steps.path.addFirst(yyVals[-2+yyTop]);
+ steps.path.addFirst((Expr) yyVals[-2+yyTop]);
yyVal = steps;
/*Step step = new Step (s, (Path) $3);*/
/*$$ = new Step ((Expr) $1, step);*/
@@ -811,7 +823,7 @@ case 50:
else
{
steps = new Steps();
- steps.path.addFirst(yyVals[-1+yyTop]);
+ steps.path.addFirst((Expr) yyVals[-1+yyTop]);
}
steps.path.addLast(s);
yyVal = steps;
OpenPOWER on IntegriCloud