Commit 365c9ab8 authored by Jens Bendisposto's avatar Jens Bendisposto
Browse files

first refactoring to clean up warnings

parent d5c5a814
......@@ -21,7 +21,7 @@ $
Macro:AlternativeHeader2
import $0$.*;
@SuppressWarnings("nls")
public final class $1$ extends $2$
{
......@@ -44,12 +44,12 @@ $
Macro:ConstructorHeaderDeclNode
@SuppressWarnings("hiding") $0$ _$1$_$2$
$0$ _$1$_$2$
$
Macro:ConstructorHeaderDeclList
@SuppressWarnings("hiding") List<$0$> _$1$_$2$
List<$0$> _$1$_$2$
$
Macro:ConstructorBodyHeader
......@@ -189,7 +189,7 @@ $
Macro:RemoveChildHeader
@Override
void removeChild(@SuppressWarnings("unused") Node child)
void removeChild( Node child)
{
// Remove child
......@@ -223,7 +223,7 @@ $
Macro:ReplaceChildHeader
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
void replaceChild( Node oldChild, Node newChild)
{
// Replace child
......
......@@ -131,7 +131,7 @@ Macro:AnalysisAdapterTail
defaultCase(node);
}
public void defaultCase(@SuppressWarnings("unused") Node node)
public void defaultCase( Node node)
{
// do nothing
}
......@@ -159,12 +159,12 @@ public class DepthFirstAdapter extends AnalysisAdapter
defaultOut(node);
}
public void defaultIn(@SuppressWarnings("unused") Node node)
public void defaultIn( Node node)
{
// Do nothing
}
public void defaultOut(@SuppressWarnings("unused") Node node)
public void defaultOut( Node node)
{
// Do nothing
}
......@@ -200,12 +200,12 @@ public class ReversedDepthFirstAdapter extends AnalysisAdapter
defaultOut(node);
}
public void defaultIn(@SuppressWarnings("unused") Node node)
public void defaultIn( Node node)
{
// Do nothing
}
public void defaultOut(@SuppressWarnings("unused") Node node)
public void defaultOut( Node node)
{
// Do nothing
}
......
......@@ -10,7 +10,7 @@ Macro:LexerException
package $0$;
@SuppressWarnings("serial")
public class LexerException extends Exception
{
public LexerException(String message)
......@@ -32,7 +32,7 @@ import $1$.*;
import de.hhu.stups.sablecc.patch.*;
@SuppressWarnings("nls")
public class Lexer implements ITokenListContainer
{
protected Token token;
......@@ -63,7 +63,7 @@ public class Lexer implements ITokenListContainer
tokenList = list;
}
@SuppressWarnings("unused")
protected void filter() throws LexerException, IOException
{
// Do nothing
......@@ -78,7 +78,7 @@ public class Lexer implements ITokenListContainer
}
public Lexer(@SuppressWarnings("hiding") PushbackReader in)
public Lexer( PushbackReader in)
{
this.in = in;
setTokenList(new ArrayList<IToken>());
......@@ -121,8 +121,8 @@ public class Lexer implements ITokenListContainer
int accept_pos = -1;
int accept_line = -1;
@SuppressWarnings("hiding") int[][][] gotoTable = Lexer.gotoTable[this.state.id()];
@SuppressWarnings("hiding") int[] accept = Lexer.accept[this.state.id()];
int[][][] gotoTable = Lexer.gotoTable[this.state.id()];
int[] accept = Lexer.accept[this.state.id()];
this.text.setLength(0);
while(true)
......@@ -216,7 +216,7 @@ $
Macro:LexerVariableToken
case $0$:
{
@SuppressWarnings("hiding") Token token = new$0$(
Token token = new$0$(
getText(accept_length),
start_line + 1,
start_pos + 1);
......@@ -229,7 +229,7 @@ $
Macro:LexerFixedToken
case $0$:
{
@SuppressWarnings("hiding") Token token = new$0$(
Token token = new$0$(
start_line + 1,
start_pos + 1);
pushBack(accept_length);
......@@ -272,7 +272,7 @@ Macro:LexerBody1
" Unknown token: " + this.text);
}
@SuppressWarnings("hiding") EOF token = new EOF(
EOF token = new EOF(
start_line + 1,
start_pos + 1);
return token;
......@@ -285,12 +285,12 @@ Macro:LexerBody1
$
Macro:LexerNewVariableToken
Token new$0$(@SuppressWarnings("hiding") String text, @SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new $1$(text, line, pos); }
Token new$0$( String text, int line, int pos) { return new $1$(text, line, pos); }
$
Macro:LexerNewFixedToken
Token new$0$(@SuppressWarnings("hiding") int line, @SuppressWarnings("hiding") int pos) { return new $1$(line, pos); }
Token new$0$( int line, int pos) { return new $1$(line, pos); }
$
......@@ -324,9 +324,9 @@ Macro:LexerBody2
}
}
protected void unread(@SuppressWarnings("hiding") Token token) throws IOException
protected void unread( Token token) throws IOException
{
@SuppressWarnings("hiding") String text = token.getText();
String text = token.getText();
int length = text.length();
for(int i = length - 1; i >= 0; i--)
......@@ -385,7 +385,7 @@ Macro:LexerStateTail
private int id;
private State(@SuppressWarnings("hiding") int id)
private State( int id)
{
this.id = id;
}
......
......@@ -21,7 +21,7 @@ import java.io.DataInputStream;
import java.io.BufferedInputStream;
import java.io.IOException;
@SuppressWarnings("nls")
public class Parser implements IParser
{
public final Analysis ignoredTokens = new AnalysisAdapter();
......@@ -45,7 +45,7 @@ public class Parser implements IParser
private ArrayList lastPopped = null;
private ITokenListContainer lex;
public Parser(@SuppressWarnings("hiding") Lexer lexer)
public Parser( Lexer lexer)
{
this.lexer = lexer;
this.lex = lexer;
......@@ -59,7 +59,7 @@ public class Parser implements IParser
checkResult(elementToCheck, false);
}
@SuppressWarnings("unchecked")
private void checkResult(Object elementToCheck, boolean slurp) {
// nodes with no tokens or sub nodes at all may exist
if (this.firstPopped == null) {
......@@ -108,7 +108,7 @@ public class Parser implements IParser
}
}
@SuppressWarnings({ "unchecked", "unused" })
private int findBeginPos(final ArrayList list,
PositionedNode n) {
Object first = list.get(0);
......@@ -139,7 +139,7 @@ public class Parser implements IParser
return item.getBeginIndex();
}
@SuppressWarnings({ "unchecked", "unused" })
private int findEndPos(final ArrayList list) {
Object last = list.get(list.size() - 1);
if (!(last instanceof PositionedNode) && !(last instanceof IToken)) {
......@@ -184,7 +184,7 @@ public class Parser implements IParser
$
Macro:ParserInliningPushHeader
@SuppressWarnings({"unchecked","unused"})
private void push(int numstate, ArrayList listNode) throws ParserException, LexerException, IOException
{
this.nodeList = listNode;
......@@ -276,7 +276,7 @@ Macro:ParserCommon
return this.converter.index;
}
@SuppressWarnings("unchecked")
public Start parse() throws ParserException, LexerException, IOException
{
this.getMapping().clear();
......@@ -391,18 +391,18 @@ $
Macro:ParserNewHeader
@SuppressWarnings("unchecked")
ArrayList new$0$() /* reduce $1$ */
{
this.firstPopped = null;
this.lastPopped = null;
@SuppressWarnings("hiding") ArrayList nodeList = new ArrayList();
ArrayList nodeList = new ArrayList();
$
Macro:ParserNewBodyDecl
@SuppressWarnings("unused") ArrayList nodeArrayList$0$ = pop();
ArrayList nodeArrayList$0$ = pop();
$
......@@ -433,7 +433,7 @@ Macro:ParserListVariableDeclaration
$
Macro:ParserNullVariableDeclaration
@SuppressWarnings("unused") Object nullNode$0$ = null;
Object nullNode$0$ = null;
$
......@@ -641,7 +641,7 @@ $
Macro:TokenIndexBody
@Override
public void case$0$(@SuppressWarnings("unused") $0$ node)
public void case$0$( $0$ node)
{
this.index = $1$;
}
......@@ -651,7 +651,7 @@ $
Macro:TokenIndexTail
@Override
public void caseEOF(@SuppressWarnings("unused") EOF node)
public void caseEOF( EOF node)
{
this.index = $0$;
}
......@@ -666,12 +666,12 @@ package $0$;
import $1$.*;
@SuppressWarnings("serial")
public class ParserException extends Exception
{
Token token;
public ParserException(@SuppressWarnings("hiding") Token token, String message)
public ParserException( Token token, String message)
{
super(message);
this.token = token;
......@@ -697,7 +697,7 @@ final class State
int state;
ArrayList nodes;
State(@SuppressWarnings("hiding") int state, @SuppressWarnings("hiding") ArrayList nodes)
State( int state, ArrayList nodes)
{
this.state = state;
this.nodes = nodes;
......
......@@ -15,7 +15,7 @@ package $0$;
import $1$.*;
@SuppressWarnings("nls")
public final class $2$ extends Token
{
public $2$(String text)
......@@ -55,7 +55,7 @@ package $0$;
import $1$.*;
@SuppressWarnings("nls")
public final class $2$ extends Token
{
public $2$()
......@@ -82,7 +82,7 @@ public final class $2$ extends Token
}
@Override
public void setText(@SuppressWarnings("unused") String text)
public void setText( String text)
{
throw new RuntimeException("Cannot change $2$ text.");
}
......
......@@ -12,7 +12,6 @@ package $0$;
import $1$.*;
@SuppressWarnings("nls")
public final class Start extends Node
{
private $2$ _$3$_;
......@@ -24,8 +23,8 @@ public final class Start extends Node
}
public Start(
@SuppressWarnings("hiding") $2$ _$3$_,
@SuppressWarnings("hiding") EOF _eof_)
$2$ _$3$_,
EOF _eof_)
{
set$2$(_$3$_);
setEOF(_eof_);
......@@ -148,7 +147,7 @@ package $0$;
import $1$.*;
@SuppressWarnings("nls")
public final class EOF extends Token
{
public EOF()
......@@ -185,7 +184,7 @@ package $0$;
import de.hhu.stups.sablecc.patch.IToken;
@SuppressWarnings("nls")
public abstract class Token extends Node implements IToken
{
private String text;
......@@ -197,7 +196,7 @@ public abstract class Token extends Node implements IToken
return this.text;
}
public void setText(@SuppressWarnings("hiding") String text)
public void setText( String text)
{
this.text = text;
}
......@@ -207,7 +206,7 @@ public abstract class Token extends Node implements IToken
return this.line;
}
public void setLine(@SuppressWarnings("hiding") int line)
public void setLine( int line)
{
this.line = line;
}
......@@ -217,7 +216,7 @@ public abstract class Token extends Node implements IToken
return this.pos;
}
public void setPos(@SuppressWarnings("hiding") int pos)
public void setPos( int pos)
{
this.pos = pos;
}
......@@ -229,13 +228,13 @@ public abstract class Token extends Node implements IToken
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
void removeChild( Node child)
{
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
void replaceChild( Node oldChild, Node newChild)
{
throw new RuntimeException("Not a child.");
}
......@@ -251,7 +250,7 @@ package $0$;
import java.util.*;
import de.hhu.stups.sablecc.patch.PositionedNode;
@SuppressWarnings("nls")
public abstract class Node extends PositionedNode implements Switchable, Cloneable
{
private Node parent;
......@@ -264,7 +263,7 @@ public abstract class Node extends PositionedNode implements Switchable, Cloneab
return this.parent;
}
void parent(@SuppressWarnings("hiding") Node parent)
void parent( Node parent)
{
this.parent = parent;
}
......@@ -299,7 +298,7 @@ public abstract class Node extends PositionedNode implements Switchable, Cloneab
return s.toString();
}
@SuppressWarnings("unchecked")
protected <T extends Node> T cloneNode(T node)
{
if(node != null)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment