Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion vm/ByteCodeTranslator/src/nativeMethods.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "java_lang_NullPointerException.h"
#include "java_lang_Class.h"
#include "java_lang_System.h"
#include "java_lang_StackOverflowError.h"

#if defined(__APPLE__) && defined(__OBJC__)
#import <Foundation/Foundation.h>
Expand Down Expand Up @@ -1552,7 +1553,11 @@ void initMethodStack(CODENAME_ONE_THREAD_STATE, JAVA_OBJECT __cn1ThisObject, int
#endif
memset(&threadStateData->threadObjectStack[threadStateData->threadObjectStackOffset], 0, sizeof(struct elementStruct) * (localsStackSize + stackSize));
threadStateData->threadObjectStackOffset += localsStackSize + stackSize;
CODENAME_ONE_ASSERT(threadStateData->callStackOffset < CN1_MAX_STACK_CALL_DEPTH - 1);
if(threadStateData->callStackOffset >= CN1_MAX_STACK_CALL_DEPTH - 1) {
JAVA_OBJECT ex = __NEW_java_lang_StackOverflowError(CN1_THREAD_STATE_PASS_SINGLE_ARG);
java_lang_StackOverflowError___INIT__(CN1_THREAD_STATE_PASS_ARG ex);
throwException(threadStateData, ex);
}
threadStateData->callStackClass[threadStateData->callStackOffset] = classNameId;
threadStateData->callStackMethod[threadStateData->callStackOffset] = methodNameId;
threadStateData->callStackOffset++;
Expand Down
35 changes: 35 additions & 0 deletions vm/JavaAPI/src/java/lang/StackOverflowError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Codename One designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Codename One through http://www.codenameone.com/ if you
* need additional information or have any questions.
*/
package java.lang;

/**
* Thrown when a stack overflow occurs because an application recurses too deeply.
*/
public class StackOverflowError extends VirtualMachineError {
public StackOverflowError() {
}

public StackOverflowError(String s) {
super(s);
}
}
Loading