Skip to content

Commit

Permalink
Fix the last of the warnings!
Browse files Browse the repository at this point in the history
  • Loading branch information
norrisboyd committed Jun 19, 2008
1 parent 7e9743f commit 81fb772
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 18 deletions.
1 change: 1 addition & 0 deletions examples/Counter.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public Counter() { }
public void jsConstructor(int a) { count = a; }

// The class name is defined by the getClassName method
@Override
public String getClassName() { return "Counter"; }

// The method jsGet_count defines the count property.
Expand Down
1 change: 1 addition & 0 deletions examples/DynamicScopes.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class DynamicScopes {

static class MyFactory extends ContextFactory
{
@Override
protected boolean hasFeature(Context cx, int featureIndex)
{
if (featureIndex == Context.FEATURE_DYNAMIC_SCOPE) {
Expand Down
2 changes: 2 additions & 0 deletions examples/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static Scriptable jsConstructor(Context cx, Object[] args,
/**
* Returns the name of this JavaScript class, "File".
*/
@Override
public String getClassName() {
return "File";
}
Expand Down Expand Up @@ -238,6 +239,7 @@ public void jsFunction_close() throws IOException {
*
* Close the file when this object is collected.
*/
@Override
protected void finalize() {
try {
jsFunction_close();
Expand Down
1 change: 1 addition & 0 deletions examples/Foo.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public Foo(int counterStart) {
/**
* Returns the name of this JavaScript class, "Foo".
*/
@Override
public String getClassName() {
return "Foo";
}
Expand Down
2 changes: 1 addition & 1 deletion examples/PrimitiveWrapFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
* on that context.
*/
public class PrimitiveWrapFactory extends WrapFactory {

@Override
public Object wrap(Context cx, Scriptable scope, Object obj,
Class<?> staticType)
{
Expand Down
1 change: 1 addition & 0 deletions examples/Shell.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class Shell extends ScriptableObject
{
private static final long serialVersionUID = -5638074146250193112L;

@Override
public String getClassName()
{
return "global";
Expand Down
3 changes: 0 additions & 3 deletions src/org/mozilla/javascript/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,6 @@ public static Context getCurrentContext()
/**
* Same as calling {@link ContextFactory#enterContext()} on the global
* ContextFactory instance.
* @deprecated use {@link ContextFactory#enter()} or
* {@link ContextFactory#call(ContextAction)} instead as this method relies
* on usage of a static singleton "global" ContextFactory.
* @return a Context associated with the current thread
* @see #getCurrentContext()
* @see #exit()
Expand Down
1 change: 0 additions & 1 deletion src/org/mozilla/javascript/ContextAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public interface ContextAction
* When Rhino runtime calls the method, <tt>cx</tt> will be associated
* with the current thread as active context.
*
* @see Context#call(ContextAction)
* @see ContextFactory#call(ContextAction)
*/
public Object run(Context cx);
Expand Down
6 changes: 3 additions & 3 deletions src/org/mozilla/javascript/Interpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2576,8 +2576,8 @@ private static Object interpretLoop(Context cx, CallFrame frame,
// When restarting continuation throwable is not null and to jump
// to the code that rewind continuation state indexReg should be set
// to -1.
// With the normal call throable == null and indexReg == -1 allows to
// catch bugs with using indeReg to access array eleemnts before
// With the normal call throwable == null and indexReg == -1 allows to
// catch bugs with using indeReg to access array elements before
// initializing indexReg.

GeneratorState generatorState = null;
Expand Down Expand Up @@ -3297,7 +3297,7 @@ private static Object interpretLoop(Context cx, CallFrame frame,
cjump = new ContinuationJump((Continuation)fun, frame);

// continuation result is the first argument if any
// of contination call
// of continuation call
if (indexReg == 0) {
cjump.result = undefined;
} else {
Expand Down
61 changes: 54 additions & 7 deletions src/org/mozilla/javascript/TokenStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,9 @@ final int getToken() throws IOException
skipLine();
continue retry;
}
ungetChar('-');
ungetCharIgnoreLineEnd('-');
}
ungetChar('!');
ungetCharIgnoreLineEnd('!');
}
if (matchChar('<')) {
if (matchChar('=')) {
Expand Down Expand Up @@ -1217,14 +1217,14 @@ private void ungetChar(int c)
Kit.codeBug();
ungetBuffer[ungetCursor++] = c;
}

private boolean matchChar(int test) throws IOException
{
int c = getChar();
int c = getCharIgnoreLineEnd();
if (c == test) {
return true;
} else {
ungetChar(c);
ungetCharIgnoreLineEnd(c);
return false;
}
}
Expand Down Expand Up @@ -1287,7 +1287,54 @@ private int getChar() throws IOException
return c;
}
}

private int getCharIgnoreLineEnd() throws IOException
{
if (ungetCursor != 0) {
return ungetBuffer[--ungetCursor];
}

for(;;) {
int c;
if (sourceString != null) {
if (sourceCursor == sourceEnd) {
hitEOF = true;
return EOF_CHAR;
}
c = sourceString.charAt(sourceCursor++);
} else {
if (sourceCursor == sourceEnd) {
if (!fillSourceBuffer()) {
hitEOF = true;
return EOF_CHAR;
}
}
c = sourceBuffer[sourceCursor++];
}

if (c <= 127) {
if (c == '\n' || c == '\r') {
lineEndChar = c;
c = '\n';
}
} else {
if (isJSFormatChar(c)) {
continue;
}
if (ScriptRuntime.isJSLineTerminator(c)) {
lineEndChar = c;
c = '\n';
}
}
return c;
}
}

private void ungetCharIgnoreLineEnd(int c)
{
ungetBuffer[ungetCursor++] = c;
}

private void skipLine() throws IOException
{
// skip to end of line
Expand Down Expand Up @@ -1379,8 +1426,8 @@ private boolean fillSourceBuffer() throws IOException

String regExpFlags;

// Set this to an inital non-null value so that the Parser has
// something to retrieve even if an error has occured and no
// Set this to an initial non-null value so that the Parser has
// something to retrieve even if an error has occurred and no
// string is found. Fosters one class of error, but saves lots of
// code.
private String string = "";
Expand Down
7 changes: 4 additions & 3 deletions testsrc/org/mozilla/javascript/tests/Bug421071Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
public class Bug421071Test extends TestCase {
private ContextFactory factory;
private TopLevelScope globalScope;
private Script script;
private Script testScript;

public void testProblemReplicator() throws Exception {
// before debugging please put the breakpoint in the
// NativeJavaPackage.getPkgProperty()
// and observe names passed in there
script = compileScript();
testScript = compileScript();
runTestScript(); // this one does not get to the
// NativeJavaPackage.getPkgProperty() on my
// variables
Expand Down Expand Up @@ -55,7 +55,7 @@ private void runTestScript() throws InterruptedException {
// will start new thread to get as close as possible to original
// environment, however the same behavior is exposed using new
// ScriptRunner(script).run();
Thread thread = new Thread(new ScriptRunner(script));
Thread thread = new Thread(new ScriptRunner(testScript));
thread.start();
thread.join();
}
Expand All @@ -79,6 +79,7 @@ private TopLevelScope createGlobalScope() {
return globalScope;
}

@Override
protected void setUp() throws Exception {
super.setUp();
globalScope = createGlobalScope();
Expand Down

0 comments on commit 81fb772

Please sign in to comment.