Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
30 agent/pom.xml
@@ -856,6 +856,21 @@
<argLine>-javaagent:${project.build.directory}/byteman-${project.version}.jar=script:${project.build.testOutputDirectory}/scripts/bugfixes/TestBooleanComparisons.btm</argLine>
</configuration>
</execution>
+ <execution>
+ <id>bugfixes.TestStackHeight</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <forkMode>once</forkMode>
+ <includes>
+ <include>org/jboss/byteman/tests/bugfixes/TestStackHeight.class</include>
+ </includes>
+ <argLine>-javaagent:${project.build.directory}/byteman-${project.version}.jar=script:${project.build.testOutputDirectory}/scripts/bugfixes/TestStackHeight.btm</argLine>
+ </configuration>
+ </execution>
<!-- dynamic rule submission
n.b. submit test does not use a script on the command line
instead it sets listener true and uplaods the rules from the test program
@@ -1616,6 +1631,21 @@
<argLine>-Dorg.jboss.byteman.compile.to.bytecode -javaagent:${project.build.directory}/byteman-${project.version}.jar=script:${project.build.testOutputDirectory}/scripts/bugfixes/TestBooleanComparisons.btm</argLine>
</configuration>
</execution>
+ <execution>
+ <id>bugfixes.TestStackHeight.compiled</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <forkMode>once</forkMode>
+ <includes>
+ <include>org/jboss/byteman/tests/bugfixes/TestStackHeight.class</include>
+ </includes>
+ <argLine>-Dorg.jboss.byteman.compile.to.bytecode -javaagent:${project.build.directory}/byteman-${project.version}.jar=script:${project.build.testOutputDirectory}/scripts/bugfixes/TestStackHeight.btm</argLine>
+ </configuration>
+ </execution>
<!-- dynamic rule submission compiled
submit test does not use a script on the command line
instead it sets listener true and uplaods the rules from the test program
View
10 agent/src/main/java/org/jboss/byteman/check/RuleCheck.java
@@ -259,12 +259,16 @@ public void checkRules() {
try {
rule.typeCheck();
+ rule.compile();
} catch (TypeWarningException te) {
typeWarning("WARNING : Unable to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine() + (methodName == null ? "" : " against method " + methodName), te);
continue;
} catch (TypeException te) {
typeError("ERROR : Failed to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine() + (methodName == null ? "" : " against method " + methodName), te);
continue;
+ } catch (CompileException ce) {
+ typeError("ERROR : Failed to compile rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine() + (methodName == null ? "" : " against method " + methodName), ce);
+ continue;
}
if (script.isOverride()) {
@@ -377,6 +381,7 @@ private void typeCheckAgainstMethodDeclaration(Rule rule, RuleScript script, Cla
if (paramErrorCount == 0) {
try {
rule.typeCheck();
+ rule.compile();
} catch (TypeWarningException te) {
typeWarning("WARNING : Unable to type check rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine(), te);
System.out.println(te);
@@ -387,6 +392,11 @@ private void typeCheckAgainstMethodDeclaration(Rule rule, RuleScript script, Cla
System.out.println(te);
System.out.println();
return;
+ } catch (CompileException ce) {
+ typeError("ERROR : Failed to compile rule \"" + script.getName() + "\" loaded from " + script.getFile() + " line " + script.getLine(), ce);
+ System.out.println(ce);
+ System.out.println();
+ return;
}
if (script.isInterface()) {
info("Type checked interface rule \"" + script.getName() + "\" against method declaration");
View
4 agent/src/main/java/org/jboss/byteman/rule/RuleElement.java
@@ -361,6 +361,10 @@ protected void compileBooleanConversion(Type fromType, Type toType, MethodVisito
throws CompileException
{
if (toType == Type.Z) {
+ if (fromType == Type.OBJECT) {
+ fromType = Type.BOOLEAN;
+ mv.visitTypeInsn(Opcodes.CHECKCAST, fromType.getInternalName(false, true));
+ }
assert fromType == Type.BOOLEAN;
compileUnbox(fromType, toType, mv, compileContext);
} else {
View
67 agent/src/test/java/org/jboss/byteman/tests/bugfixes/TestStackHeight.java
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013, Red Hat and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ * @authors Andrew Dinn
+ */
+
+/**
+ * Test for BYTEMAN-254 to ensure that compilation of field expressions in
+ * conditions does not fail with an invalid stack height
+ */
+package org.jboss.byteman.tests.bugfixes;
+
+import org.jboss.byteman.tests.Test;
+
+public class TestStackHeight extends Test
+{
+ private boolean testField;
+
+ public TestStackHeight()
+ {
+ super("TestStackHeight");
+ testField = false;
+ }
+
+ public void setTestField(boolean value)
+ {
+ log("setting field " + testField);
+ testField = value;
+ log("set field " + testField);
+ }
+
+ public boolean isTestField()
+ {
+ return testField;
+ }
+ public void test()
+ {
+ TestStackHeight test = new TestStackHeight();
+ setTestField(true);
+ }
+
+ @Override
+ public String getExpected() {
+ logExpected("setting field false");
+ logExpected("set field true");
+
+ return super.getExpected();
+ }
+}
View
33 agent/src/test/resources/scripts/bugfixes/TestStackHeight.btm
@@ -0,0 +1,33 @@
+##############################################################################
+# JBoss, Home of Professional Open Source
+# Copyright 2013, Red Hat and individual contributors
+# by the @authors tag. See the copyright.txt in the distribution for a
+# full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+# @authors Andrew Dinn
+#
+# Test for BYTEMAN-254 to ensure that compilation of field expressions in
+# conditions does not fail with an invalid stack height
+
+RULE TestStackHeight
+CLASS org.jboss.byteman.tests.bugfixes.TestStackHeight
+METHOD setTestField(boolean)
+AT ENTRY
+IF $this.testField
+DO $this.log("should not get here!")
+ENDRULE

No commit comments for this range

Something went wrong with that request. Please try again.