summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/gluegen
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-04-16 00:13:17 +0200
committerSven Gothel <[email protected]>2012-04-16 00:13:17 +0200
commit900b2a73b2d0b6f934718ac88015151c5bf7ccb8 (patch)
treebcc9f366685343b66d06372c427744c60839bfbb /src/java/com/jogamp/gluegen
parent94863d2e14ad7334fe5318d827878ce3b6424818 (diff)
StringBuffer -> StringBuilder (Local objects, no concurrency)
Diffstat (limited to 'src/java/com/jogamp/gluegen')
-rw-r--r--src/java/com/jogamp/gluegen/CMethodBindingEmitter.java4
-rw-r--r--src/java/com/jogamp/gluegen/TypeInfo.java2
-rw-r--r--src/java/com/jogamp/gluegen/cgram/CSymbolTable.java25
-rw-r--r--src/java/com/jogamp/gluegen/cgram/LineObject.java4
-rw-r--r--src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java20
-rw-r--r--src/java/com/jogamp/gluegen/cgram/TNode.java4
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/ArrayType.java2
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/CompoundType.java2
-rw-r--r--src/java/com/jogamp/gluegen/cgram/types/FunctionType.java2
-rwxr-xr-xsrc/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java3
10 files changed, 33 insertions, 35 deletions
diff --git a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
index 23c2b95..eecd29d 100644
--- a/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/CMethodBindingEmitter.java
@@ -1090,7 +1090,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
}
protected String jniMangle(MethodBinding binding) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(jniMangle(getName()));
buf.append(getImplSuffix());
buf.append("__");
@@ -1147,7 +1147,7 @@ public class CMethodBindingEmitter extends FunctionEmitter {
return buf.toString();
}
- protected void jniMangle(Class<?> c, StringBuffer res, boolean syntheticArgument) {
+ protected void jniMangle(Class<?> c, StringBuilder res, boolean syntheticArgument) {
if (c.isPrimitive()) {
if (c == Boolean.TYPE) res.append("Z");
else if (c == Byte.TYPE) res.append("B");
diff --git a/src/java/com/jogamp/gluegen/TypeInfo.java b/src/java/com/jogamp/gluegen/TypeInfo.java
index b62fc15..e480571 100644
--- a/src/java/com/jogamp/gluegen/TypeInfo.java
+++ b/src/java/com/jogamp/gluegen/TypeInfo.java
@@ -62,7 +62,7 @@ public class TypeInfo {
@Override
public String toString() {
- StringBuffer buf = new StringBuffer("TypeInfo: ");
+ StringBuilder buf = new StringBuilder("TypeInfo: ");
buf.append(name);
buf.append(" pointerDepth ");
buf.append(pointerDepth);
diff --git a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java
index 0addf7b..2f25e75 100644
--- a/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java
+++ b/src/java/com/jogamp/gluegen/cgram/CSymbolTable.java
@@ -5,18 +5,17 @@ import java.util.Hashtable;
import java.util.Enumeration;
-
public class CSymbolTable {
/** holds list of scopes */
- private Vector scopeStack;
+ private Vector<String> scopeStack;
/** table where all defined names are mapped to TNode tree nodes */
- private Hashtable symTable;
+ private Hashtable<String, TNode> symTable;
public CSymbolTable() {
- scopeStack = new Vector(10);
- symTable = new Hashtable(533);
+ scopeStack = new Vector<String>(10);
+ symTable = new Hashtable<String, TNode>(533);
}
@@ -39,9 +38,9 @@ public class CSymbolTable {
/** return the current scope as a string
*/
public String currentScopeAsString() {
- StringBuffer buf = new StringBuffer(100);
+ StringBuilder buf = new StringBuilder(100);
boolean first = true;
- Enumeration e = scopeStack.elements();
+ Enumeration<String> e = scopeStack.elements();
while(e.hasMoreElements()) {
if(first)
first = false;
@@ -85,13 +84,13 @@ public class CSymbolTable {
/** add a node to the table with it's key as
the current scope and the name */
public TNode add(String name, TNode node) {
- return (TNode)symTable.put(addCurrentScopeToName(name),node);
+ return symTable.put(addCurrentScopeToName(name),node);
}
/** lookup a fully scoped name in the symbol table */
public TNode lookupScopedName(String scopedName) {
- return (TNode)symTable.get(scopedName);
+ return symTable.get(scopedName);
}
/** lookup an unscoped name in the table by prepending
@@ -108,7 +107,7 @@ public class CSymbolTable {
while (tnode == null && scope != null) {
scopedName = addScopeToName(scope, name);
//System.out.println("lookup trying " + scopedName);
- tnode = (TNode)symTable.get(scopedName);
+ tnode = symTable.get(scopedName);
scope = removeOneLevelScope(scope);
}
return tnode;
@@ -116,11 +115,11 @@ public class CSymbolTable {
/** convert this table to a string */
public String toString() {
- StringBuffer buff = new StringBuffer(300);
+ StringBuilder buff = new StringBuilder(300);
buff.append("CSymbolTable { \nCurrentScope: " + currentScopeAsString() +
"\nDefinedSymbols:\n");
- Enumeration ke = symTable.keys();
- Enumeration ve = symTable.elements();
+ Enumeration<String> ke = symTable.keys();
+ Enumeration<TNode> ve = symTable.elements();
while(ke.hasMoreElements()) {
buff.append(ke.nextElement().toString() + " (" +
TNode.getNameForType(((TNode)ve.nextElement()).getType()) + ")\n");
diff --git a/src/java/com/jogamp/gluegen/cgram/LineObject.java b/src/java/com/jogamp/gluegen/cgram/LineObject.java
index c03b3e8..5104497 100644
--- a/src/java/com/jogamp/gluegen/cgram/LineObject.java
+++ b/src/java/com/jogamp/gluegen/cgram/LineObject.java
@@ -106,8 +106,8 @@ class LineObject {
}
public String toString() {
- StringBuffer ret;
- ret = new StringBuffer("# " + line + " \"" + source + "\"");
+ StringBuilder ret;
+ ret = new StringBuilder("# " + line + " \"" + source + "\"");
if (enteringFile) {
ret.append(" 1");
}
diff --git a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java
index 5e7018f..5281ab1 100644
--- a/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java
+++ b/src/java/com/jogamp/gluegen/cgram/PreprocessorInfoChannel.java
@@ -4,18 +4,18 @@ import java.util.*;
public class PreprocessorInfoChannel
{
- Hashtable lineLists = new Hashtable(); // indexed by Token number
+ Hashtable<Integer, Vector<Object>> lineLists = new Hashtable<Integer, Vector<Object>>(); // indexed by Token number
int firstValidTokenNumber = 0;
int maxTokenNumber = 0;
public void addLineForTokenNumber( Object line, Integer toknum )
{
if ( lineLists.containsKey( toknum ) ) {
- Vector lines = (Vector) lineLists.get( toknum );
+ Vector<Object> lines = lineLists.get( toknum );
lines.addElement(line);
}
else {
- Vector lines = new Vector();
+ Vector<Object> lines = new Vector<Object>();
lines.addElement(line);
lineLists.put(toknum, lines);
if ( maxTokenNumber < toknum.intValue() ) {
@@ -29,16 +29,16 @@ public class PreprocessorInfoChannel
return maxTokenNumber;
}
- public Vector extractLinesPrecedingTokenNumber( Integer toknum )
+ public Vector<Object> extractLinesPrecedingTokenNumber( Integer toknum )
{
- Vector lines = new Vector();
+ Vector<Object> lines = new Vector<Object>();
if (toknum == null) return lines;
for (int i = firstValidTokenNumber; i < toknum.intValue(); i++){
Integer inti = new Integer(i);
if ( lineLists.containsKey( inti ) ) {
- Vector tokenLineVector = (Vector) lineLists.get( inti );
+ Vector<Object> tokenLineVector = lineLists.get( inti );
if ( tokenLineVector != null) {
- Enumeration tokenLines = tokenLineVector.elements();
+ Enumeration<Object> tokenLines = tokenLineVector.elements();
while ( tokenLines.hasMoreElements() ) {
lines.addElement( tokenLines.nextElement() );
}
@@ -52,13 +52,13 @@ public class PreprocessorInfoChannel
public String toString()
{
- StringBuffer sb = new StringBuffer("PreprocessorInfoChannel:\n");
+ StringBuilder sb = new StringBuilder("PreprocessorInfoChannel:\n");
for (int i = 0; i <= maxTokenNumber + 1; i++){
Integer inti = new Integer(i);
if ( lineLists.containsKey( inti ) ) {
- Vector tokenLineVector = (Vector) lineLists.get( inti );
+ Vector<Object> tokenLineVector = lineLists.get( inti );
if ( tokenLineVector != null) {
- Enumeration tokenLines = tokenLineVector.elements();
+ Enumeration<Object> tokenLines = tokenLineVector.elements();
while ( tokenLines.hasMoreElements() ) {
sb.append(inti + ":" + tokenLines.nextElement() + '\n');
}
diff --git a/src/java/com/jogamp/gluegen/cgram/TNode.java b/src/java/com/jogamp/gluegen/cgram/TNode.java
index e9185f9..f7feecc 100644
--- a/src/java/com/jogamp/gluegen/cgram/TNode.java
+++ b/src/java/com/jogamp/gluegen/cgram/TNode.java
@@ -155,7 +155,7 @@ public void initialize(AST tr) {
/** Returns the text for this node and all children */
public String getAllChildrenText() {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(getText());
for (TNode node = (TNode) getFirstChild(); node != null; node = (TNode) node.getNextSibling()) {
buf.append(node.getText());
@@ -304,7 +304,7 @@ public void initialize(AST tr) {
/** return a short string representation of the node */
public String toString() {
- StringBuffer str = new StringBuffer( getNameForType(getType()) +
+ StringBuilder str = new StringBuilder( getNameForType(getType()) +
"[" + getText() + ", " + "]");
if(this.getLineNum() != 0)
diff --git a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java
index 4ede5aa..7bd7d42 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/ArrayType.java
@@ -111,7 +111,7 @@ public class ArrayType extends MemoryLayoutType implements Cloneable {
}
public String toString(String variableName) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
buf.append(elementType.getName());
if (variableName != null) {
buf.append(" ");
diff --git a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
index 7a4b45d..a4b419f 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/CompoundType.java
@@ -206,7 +206,7 @@ public abstract class CompoundType extends MemoryLayoutType implements Cloneable
try {
visiting = true;
String kind = (isStruct() ? "struct {" : "union {");
- StringBuffer res = new StringBuffer();
+ StringBuilder res = new StringBuilder();
res.append(kind);
int n = getNumFields();
for (int i = 0; i < n; i++) {
diff --git a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
index cb430db..4c908dc 100644
--- a/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
+++ b/src/java/com/jogamp/gluegen/cgram/types/FunctionType.java
@@ -134,7 +134,7 @@ public class FunctionType extends Type implements Cloneable {
}
String toString(String functionName, String callingConvention, boolean emitNativeTag, boolean isPointer) {
- StringBuffer res = new StringBuffer();
+ StringBuilder res = new StringBuilder();
res.append(getReturnType());
res.append(" ");
if (isPointer) {
diff --git a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
index fedb1e6..aecb079 100755
--- a/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
+++ b/src/java/com/jogamp/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java
@@ -43,7 +43,6 @@ import com.jogamp.gluegen.CMethodBindingEmitter;
import com.jogamp.gluegen.MethodBinding;
import com.jogamp.gluegen.JavaType;
import java.io.*;
-import com.jogamp.gluegen.*;
import com.jogamp.gluegen.cgram.types.*;
public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter {
@@ -203,7 +202,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter {
@Override
protected String jniMangle(MethodBinding binding) {
- StringBuffer buf = new StringBuffer(super.jniMangle(binding));
+ StringBuilder buf = new StringBuilder(super.jniMangle(binding));
if (callThroughProcAddress) {
jniMangle(Long.TYPE, buf, false); // to account for the additional _addr_ parameter
}