From 7607867f0bba56792cad320695d6209b49acce9d Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Thu, 17 Oct 2013 21:34:47 -0700 Subject: gluegen: add all missing @Override annotations Signed-off-by: Harvey Harrison --- .../com/jogamp/gluegen/cgram/CSymbolTable.java | 1 + src/java/com/jogamp/gluegen/cgram/CToken.java | 1 + src/java/com/jogamp/gluegen/cgram/LineObject.java | 1 + .../gluegen/cgram/PreprocessorInfoChannel.java | 1 + src/java/com/jogamp/gluegen/cgram/TNode.java | 7 ++++++ .../com/jogamp/gluegen/cgram/TNodeFactory.java | 3 +++ .../com/jogamp/gluegen/cgram/types/ArrayType.java | 1 + .../jogamp/gluegen/cgram/types/CompoundType.java | 1 + .../com/jogamp/gluegen/cgram/types/DoubleType.java | 1 + .../com/jogamp/gluegen/cgram/types/EnumType.java | 1 + .../com/jogamp/gluegen/cgram/types/FloatType.java | 1 + .../jogamp/gluegen/cgram/types/FunctionType.java | 2 ++ .../com/jogamp/gluegen/cgram/types/IntType.java | 1 + .../jogamp/gluegen/cgram/types/PointerType.java | 1 + .../com/jogamp/gluegen/cgram/types/SizeThunk.java | 29 ++++++++++++++++++++++ .../com/jogamp/gluegen/cgram/types/StructType.java | 3 +++ src/java/com/jogamp/gluegen/cgram/types/Type.java | 1 + .../com/jogamp/gluegen/cgram/types/UnionType.java | 3 +++ .../com/jogamp/gluegen/cgram/types/VoidType.java | 1 + 19 files changed, 60 insertions(+) (limited to 'src/java/com/jogamp/gluegen/cgram') diff --git a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java index 69ec0ed..ec2f979 100644 --- a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java +++ b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java @@ -114,6 +114,7 @@ public class CSymbolTable { } /** convert this table to a string */ + @Override public String toString() { StringBuilder buff = new StringBuilder(300); buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() + diff --git a/src/java/com/jogamp/gluegen/cgram/CToken.java b/src/java/com/jogamp/gluegen/cgram/CToken.java index 7bd48ad..cfa88fc 100644 --- a/src/java/com/jogamp/gluegen/cgram/CToken.java +++ b/src/java/com/jogamp/gluegen/cgram/CToken.java @@ -26,6 +26,7 @@ public class CToken extends antlr.CommonToken { tokenNumber = i; } + @Override public String toString() { return "CToken:" +"(" + hashCode() + ")" + "[" + getType() + "] "+ getText() + " line:" + getLine() + " source:" + source ; } diff --git a/src/java/com/jogamp/gluegen/cgram/LineObject.java b/src/java/com/jogamp/gluegen/cgram/LineObject.java index 4914759..31489fc 100644 --- a/src/java/com/jogamp/gluegen/cgram/LineObject.java +++ b/src/java/com/jogamp/gluegen/cgram/LineObject.java @@ -105,6 +105,7 @@ class LineObject { return treatAsC; } + @Override public String toString() { StringBuilder ret; ret = new StringBuilder("# " + line + " \"" + source + "\""); diff --git a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java index 7cf64b0..3bc8056 100644 --- a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java +++ b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java @@ -50,6 +50,7 @@ public class PreprocessorInfoChannel return lines; } + @Override public String toString() { StringBuilder sb = new StringBuilder("PreprocessorInfoChannel:\n"); diff --git a/src/java/com/jogamp/gluegen/cgram/TNode.java b/src/java/com/jogamp/gluegen/cgram/TNode.java index 00c4ffa..2840d01 100644 --- a/src/java/com/jogamp/gluegen/cgram/TNode.java +++ b/src/java/com/jogamp/gluegen/cgram/TNode.java @@ -51,6 +51,7 @@ public class TNode extends CommonAST { } +@Override public void initialize(Token token) { CToken tok = (CToken) token; setText(tok.getText()); @@ -59,6 +60,7 @@ public void initialize(Token token) { setAttribute("source", tok.getSource()); setAttribute("tokenNumber", new Integer(tok.getTokenNumber())); } +@Override public void initialize(AST tr) { TNode t = (TNode) tr; setText(t.getText()); @@ -70,9 +72,11 @@ public void initialize(AST tr) { /** Get the token type for this node */ + @Override public int getType() { return ttype; } /** Set the token type for this node */ + @Override public void setType(int ttype_) { ttype = ttype_; } @@ -146,9 +150,11 @@ public void initialize(AST tr) { } /** Get the token text for this node */ + @Override public String getText() { return text; } /** Set the token text for this node */ + @Override public void setText(String text_) { text = text_; } @@ -303,6 +309,7 @@ public void initialize(AST tr) { /** return a short string representation of the node */ + @Override public String toString() { StringBuilder str = new StringBuilder( getNameForType(getType()) + "[" + getText() + ", " + "]"); diff --git a/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java b/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java index 2984a84..ccbd233 100644 --- a/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java +++ b/src/java/com/jogamp/gluegen/cgram/TNodeFactory.java @@ -9,11 +9,13 @@ import antlr.collections.AST; public class TNodeFactory extends ASTFactory { /** Create a new ampty AST node */ + @Override public AST create() { return new TNode(); } /** Create a new AST node from type and text */ + @Override public AST create(int ttype, String text) { AST ast = new TNode(); ast.setType(ttype); @@ -22,6 +24,7 @@ public class TNodeFactory extends ASTFactory { } /** Create a new AST node from an existing AST node */ + @Override public AST create(AST ast) { AST newast = new TNode(); newast.setType(ast.getType()); diff --git a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java index bad63db..6cedc9c 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java @@ -129,6 +129,7 @@ public class ArrayType extends MemoryLayoutType implements Cloneable { elementType.visit(arg); } + @Override Type newCVVariant(int cvAttributes) { return new ArrayType(elementType, getSize(), length, cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java index 4582a81..803cb50 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java @@ -71,6 +71,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable } } + @Override public Object clone() { CompoundType n = (CompoundType) super.clone(); if(null!=this.fields) { diff --git a/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java b/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java index e95ffb9..278b3d8 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/DoubleType.java @@ -62,6 +62,7 @@ public class DoubleType extends PrimitiveType implements Cloneable { return this; } + @Override Type newCVVariant(int cvAttributes) { return new DoubleType(getName(), getSize(), cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java index 9e142bd..d02388b 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/EnumType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/EnumType.java @@ -85,6 +85,7 @@ public class EnumType extends IntType implements Cloneable { this.underlyingType = underlyingType; } + @Override public Object clone() { EnumType n = (EnumType) super.clone(); if(null!=this.underlyingType) { diff --git a/src/java/com/jogamp/gluegen/cgram/types/FloatType.java b/src/java/com/jogamp/gluegen/cgram/types/FloatType.java index dff7a00..ef1b4b9 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/FloatType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/FloatType.java @@ -61,6 +61,7 @@ public class FloatType extends PrimitiveType implements Cloneable { @Override public FloatType asFloat() { return this; } + @Override Type newCVVariant(int cvAttributes) { return new FloatType(getName(), getSize(), cvAttributes); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java index c32d184..bb62eba 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java @@ -54,6 +54,7 @@ public class FunctionType extends Type implements Cloneable { this.returnType = returnType; } + @Override public Object clone() { FunctionType n = (FunctionType) super.clone(); if(null!=this.argumentTypes) { @@ -195,6 +196,7 @@ public class FunctionType extends Type implements Cloneable { } } + @Override Type newCVVariant(int cvAttributes) { // Functions don't have const/volatile attributes return this; diff --git a/src/java/com/jogamp/gluegen/cgram/types/IntType.java b/src/java/com/jogamp/gluegen/cgram/types/IntType.java index b37e741..ffc5696 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/IntType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/IntType.java @@ -87,6 +87,7 @@ public class IntType extends PrimitiveType implements Cloneable { return getCVAttributesString() + ((isUnsigned() & (!typedefedUnsigned)) ? "unsigned " : "") + getName(); } + @Override Type newCVVariant(int cvAttributes) { return new IntType(getName(), getSize(), isUnsigned(), cvAttributes, typedefedUnsigned); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java index 92544c5..4922d28 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/PointerType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/PointerType.java @@ -153,6 +153,7 @@ public class PointerType extends Type implements Cloneable { targetType.visit(arg); } + @Override Type newCVVariant(int cvAttributes) { return new PointerType(getSize(), targetType, cvAttributes, hasTypedefedName, (hasTypedefedName ? getName() : null)); } diff --git a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java index b40d4f3..021fa90 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java +++ b/src/java/com/jogamp/gluegen/cgram/types/SizeThunk.java @@ -53,6 +53,7 @@ public abstract class SizeThunk implements Cloneable { // Private constructor because there are only a few of these private SizeThunk(boolean fixedNativeSize) { this.fixedNativeSize = fixedNativeSize; } + @Override public Object clone() { try { return super.clone(); @@ -67,81 +68,99 @@ public abstract class SizeThunk implements Cloneable { public abstract long computeAlignment(MachineDescription machDesc); public static final SizeThunk INT8 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int8SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int8AlignmentInBytes(); } }; public static final SizeThunk INT16 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int16SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int16AlignmentInBytes(); } }; public static final SizeThunk INT32 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int32SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int32AlignmentInBytes(); } }; public static final SizeThunk INTxx = new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.intSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.intAlignmentInBytes(); } }; public static final SizeThunk LONG = new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.longSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.longAlignmentInBytes(); } }; public static final SizeThunk INT64 = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.int64SizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.int64AlignmentInBytes(); } }; public static final SizeThunk FLOAT = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.floatSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.floatAlignmentInBytes(); } }; public static final SizeThunk DOUBLE = new SizeThunk(true) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.doubleSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.doubleAlignmentInBytes(); } }; public static final SizeThunk POINTER = new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return machDesc.pointerSizeInBytes(); } + @Override public long computeAlignment(MachineDescription machDesc) { return machDesc.pointerAlignmentInBytes(); } @@ -152,9 +171,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk add(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return thunk1.computeSize(machDesc) + thunk2.computeSize(machDesc); } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = thunk1.computeAlignment(machDesc); final long thunk2A = thunk2.computeAlignment(machDesc); @@ -166,9 +187,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk mul(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return thunk1.computeSize(machDesc) * thunk2.computeSize(machDesc); } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = thunk1.computeAlignment(machDesc); final long thunk2A = thunk2.computeAlignment(machDesc); @@ -180,6 +203,7 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk align(final SizeThunk offsetThunk, final SizeThunk alignmentThunk) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { // x % 2n == x & (2n - 1) // remainder = net_size & ( alignment - 1 ) @@ -194,6 +218,7 @@ public abstract class SizeThunk implements Cloneable { return size + padding; } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = offsetThunk.computeAlignment(machDesc); final long thunk2A = alignmentThunk.computeAlignment(machDesc); @@ -205,9 +230,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk max(final SizeThunk thunk1, final SizeThunk thunk2) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return Math.max(thunk1.computeSize(machDesc), thunk2.computeSize(machDesc)); } + @Override public long computeAlignment(MachineDescription machDesc) { final long thunk1A = thunk1.computeAlignment(machDesc); final long thunk2A = thunk2.computeAlignment(machDesc); @@ -218,9 +245,11 @@ public abstract class SizeThunk implements Cloneable { public static SizeThunk constant(final int constant) { return new SizeThunk(false) { + @Override public long computeSize(MachineDescription machDesc) { return constant; } + @Override public long computeAlignment(MachineDescription machDesc) { return 1; // no alignment for constants } diff --git a/src/java/com/jogamp/gluegen/cgram/types/StructType.java b/src/java/com/jogamp/gluegen/cgram/types/StructType.java index 74fca7c..da58a5f 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/StructType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/StructType.java @@ -45,9 +45,12 @@ public class StructType extends CompoundType { return super.equals(arg); } + @Override public final boolean isStruct() { return true; } + @Override public final boolean isUnion() { return false; } + @Override Type newCVVariant(int cvAttributes) { StructType t = new StructType(getName(), getSize(), cvAttributes, getStructName()); t.setFields(getFields()); diff --git a/src/java/com/jogamp/gluegen/cgram/types/Type.java b/src/java/com/jogamp/gluegen/cgram/types/Type.java index cffbb67..a403de6 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/Type.java +++ b/src/java/com/jogamp/gluegen/cgram/types/Type.java @@ -63,6 +63,7 @@ public abstract class Type implements Cloneable { hasTypedefName = false; } + @Override public Object clone() { try { return super.clone(); diff --git a/src/java/com/jogamp/gluegen/cgram/types/UnionType.java b/src/java/com/jogamp/gluegen/cgram/types/UnionType.java index 857507c..36b4fdb 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/UnionType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/UnionType.java @@ -45,9 +45,12 @@ public class UnionType extends CompoundType { return super.equals(arg); } + @Override public final boolean isStruct() { return false; } + @Override public final boolean isUnion() { return true; } + @Override Type newCVVariant(int cvAttributes) { UnionType t = new UnionType(getName(), getSize(), cvAttributes, getStructName()); t.setFields(getFields()); diff --git a/src/java/com/jogamp/gluegen/cgram/types/VoidType.java b/src/java/com/jogamp/gluegen/cgram/types/VoidType.java index 1f76e70..afde0d2 100644 --- a/src/java/com/jogamp/gluegen/cgram/types/VoidType.java +++ b/src/java/com/jogamp/gluegen/cgram/types/VoidType.java @@ -54,6 +54,7 @@ public class VoidType extends Type implements Cloneable { return this; } + @Override Type newCVVariant(int cvAttributes) { return new VoidType(getName(), cvAttributes); } -- cgit v1.2.3