Skip to content

Commit

Permalink
Showing 30 changed files with 1,630 additions and 542 deletions.
13 changes: 7 additions & 6 deletions bin/jruby.bash
Original file line number Diff line number Diff line change
@@ -146,12 +146,6 @@ for j in "$JRUBY_HOME"/lib/jruby.jar "$JRUBY_HOME"/lib/jruby-complete.jar; do
JRUBY_ALREADY_ADDED=true
done

# The Truffle jar always needs to be on the boot classpath, if it exists, so
# that the VM can substitute classes.
if [ -e "$JRUBY_HOME/lib/jruby-truffle.jar" ]; then
JRUBY_CP="$JRUBY_CP$CP_DELIMITER$JRUBY_HOME/lib/jruby-truffle.jar"
fi

if $cygwin; then
JRUBY_CP=`cygpath -p -w "$JRUBY_CP"`
fi
@@ -167,6 +161,9 @@ else
if [ "$j" == "$JRUBY_HOME"/lib/jruby.jar ]; then
continue
fi
if [ "$j" == "$JRUBY_HOME"/lib/jruby-truffle.jar ]; then
continue
fi
if [ "$j" == "$JRUBY_HOME"/lib/jruby-complete.jar ]; then
continue
fi
@@ -257,6 +254,10 @@ do
-X*\.\.\.|-X*\?)
ruby_args=("${ruby_args[@]}" "$1") ;;
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X+T)
JRUBY_CP="$JRUBY_CP$CP_DELIMITER$JRUBY_HOME/lib/jruby-truffle.jar"
ruby_args=("${ruby_args[@]}" "-X+T")
;;
-X*)
val=${1:2}
if expr "$val" : '.*[.]' > /dev/null; then
13 changes: 7 additions & 6 deletions bin/jruby.sh
Original file line number Diff line number Diff line change
@@ -107,12 +107,6 @@ for j in "$JRUBY_HOME"/lib/jruby.jar "$JRUBY_HOME"/lib/jruby-complete.jar; do
JRUBY_ALREADY_ADDED=true
done

# The Truffle jar always needs to be on the boot classpath, if it exists, so
# that the VM can substitute classes.
if [ -e "$JRUBY_HOME/lib/jruby-truffle.jar" ]; then
JRUBY_CP="$JRUBY_CP$CP_DELIMITER$JRUBY_HOME/lib/jruby-truffle.jar"
fi

# ----- Set Up The System Classpath -------------------------------------------

if [ "$JRUBY_PARENT_CLASSPATH" != "" ]; then
@@ -124,6 +118,9 @@ else
if [ "$j" == "$JRUBY_HOME"/lib/jruby.jar ]; then
continue
fi
if [ "$j" == "$JRUBY_HOME"/lib/jruby-truffle.jar ]; then
continue
fi
if [ "$j" == "$JRUBY_HOME"/lib/jruby-complete.jar ]; then
continue
fi
@@ -200,6 +197,10 @@ do
-X*\.\.\.|-X*\?)
ruby_args="${ruby_args} $1" ;;
# Match -Xa.b.c=d to translate to -Da.b.c=d as a java option
-X+T)
JRUBY_CP="$JRUBY_CP$CP_DELIMITER$JRUBY_HOME/lib/jruby-truffle.jar"
ruby_args="${ruby_args} -X+T"
;;
-X*)
val=${1:2}
if expr "$val" : '.*[.]' > /dev/null; then
2 changes: 1 addition & 1 deletion core/pom.rb
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
jar 'org.jruby.jcodings:jcodings:1.0.16-SNAPSHOT'
jar 'org.jruby:dirgra:0.3'

jar 'com.headius:invokebinder:1.5'
jar 'com.headius:invokebinder:1.7-SNAPSHOT'
jar 'com.headius:options:1.4-SNAPSHOT'
jar 'com.headius:coro-mock:1.0', :scope => 'provided'
jar 'com.headius:unsafe-mock', '${unsafe.version}', :scope => 'provided'
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.headius</groupId>
<artifactId>invokebinder</artifactId>
<version>1.5</version>
<version>1.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.headius</groupId>
110 changes: 110 additions & 0 deletions core/src/main/java/org/jruby/anno/ExecutableElementDescriptor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
***** BEGIN LICENSE BLOCK *****
* Version: EPL 1.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/epl-v10.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Copyright (C) 2008-2013 Charles Oliver Nutter <headius@headius.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package org.jruby.anno;

import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.NestingKind;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
import java.lang.annotation.Annotation;
import java.lang.reflect.Modifier;
import java.util.List;
import java.util.Set;

/**
* A version of MethodDescriptor that works against ExecutableElement during compile time annotation processing.
*/
public class ExecutableElementDescriptor extends MethodDescriptor<ExecutableElement> {
public final ExecutableElement method;

public ExecutableElementDescriptor(ExecutableElement method) {
super(method);
this.method = method;
}

protected <A extends Annotation> A getAnnotation(ExecutableElement methodObject, Class<A> annotationType) {
return methodObject.getAnnotation(annotationType);
}

protected int getModifiers(ExecutableElement methodObject) {
Set<javax.lang.model.element.Modifier> mods = methodObject.getModifiers();
int modifierTmp = 0;
try {
// TODO: gross
for (javax.lang.model.element.Modifier mod : mods) {
modifierTmp |= (Integer) Modifier.class.getField(mod.name()).get(null);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return modifierTmp;
}

protected String getDeclaringClassName(ExecutableElement methodObject) {
return getActualQualifiedName((TypeElement) methodObject.getEnclosingElement()).toString();
}

protected String getSimpleName(ExecutableElement methodObject) {
return methodObject.getSimpleName().toString();
}

protected boolean hasContext(ExecutableElement methodObject) {
List<? extends VariableElement> symbolicParameters = methodObject.getParameters();
if (symbolicParameters.size() > 0) {
return symbolicParameters.get(0).asType().toString().equals("org.jruby.runtime.ThreadContext");
}

return false;
}

protected boolean hasBlock(ExecutableElement methodObject) {
List<? extends VariableElement> symbolicParameters = methodObject.getParameters();

if (symbolicParameters.size() > 0) {
return symbolicParameters.get(symbolicParameters.size() - 1).asType().toString().equals("org.jruby.runtime.Block");
}

return false;
}

protected int parameterCount(ExecutableElement methodObject) {
return methodObject.getParameters().size();
}

protected String parameterAsString(ExecutableElement methodObject, int index) {
return methodObject.getParameters().get(index).asType().toString();
}

public static CharSequence getActualQualifiedName(TypeElement td) {
if (td.getNestingKind() == NestingKind.MEMBER) {
return getActualQualifiedName((TypeElement)td.getEnclosingElement()) + "$" + td.getSimpleName();
}
return td.getQualifiedName().toString();
}
}
Loading

0 comments on commit da784fd

Please sign in to comment.