A remedy for an IllegalAccessError where generated bytecode
referred to an inaccessible type. Closes SI-1430.
Bonus materials:
- tore out all the invokedynamic support. The shipped jdk7
implementation shows limited resemblance to the one this was written
against; the code mostly serves to distract. (I think I could get
invokedynamic working pretty quickly, except that it would
mean having a codebase for java7 and one for 5-6, which is not a yak
I wish to shave today.)
- gave NullClass and NothingClass objects of their own, which
allowed a nice polymorphic simplification of isSubClass, plus a
couple other streamlinings.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@26078 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
It took me a long time to find a trivial error while adjusting the
annotation packages, so I spent even longer trying to make sure next
time it would take me less time. It's the usual business of eliminating
duplication and unnecessary indirection.
Behavioral note: there was no consistency or deducible reasoning
regarding when annotation checks would be performed against the
typeSymbol directly (thus excluding annotation subclasses) or when they
would do a subclass check. I saw no reason it shouldn't always be a
subclass check; if the annotation isn't supposed to be subclassed it
should be final, and if it is, then the subclasses had probably better
not stop exhibiting the behavior of the base class.
Example: this now draws deprecated warnings, but did not before.
class bippy extends deprecated("hi mom", "burma shave")
@bippy def f = 5
(The deprecation message isn't printed so we're not there yet,
but closer.)
There is some new internal documentation on annotations, sadly lacking
in my famous ascii diagrams, and some new conveniences. Review by rytz.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25811 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
Old Man Reflection is coming home and he's not going to like
finding out a bunch of beans have moved into his reflecting room.
We had better evict those guys before he blows his stack.
scala.reflect.*Bean* --> scala.beans.*
scala.beans, that's kind of a fancy package name for some beans. I
figure it's time to start fishing or cutting bait on this kind of thing.
I don't even know what beans are, but if we're going to have them in the
mainline, the least surprising place to find them is scala.beans. If we
don't want to put them in scala.beans for whatever reason, then I say
they don't belong in trunk at all.
Bonus round:
scala.annotation.target --> scala.beans.meta
I don't know if there is any more unfortunate name for a package
possible than "target". Maybe ".svn" or ".git" if you could have dots
in package names. Package CVS wouldn't hit too hard these days. Package
lib_managed? I'll try to come up with something. In any case this golden
opportunity could not be squandered.
There is a new starr included, because GenJVM contains all kinds of
shooting-from-the-hip Bean-related name hardcoding. (Yes, still. I ran
out of stones. So a few birds escape with their lives... this time.)
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25773 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
a word, ctrl-X deletes the word in front of the cursor), thanks to
Kenji Matsuoka for portions of this patch.
Note to OSX users: TIL learned that ctrl-O is swallowed by the terminal
and that unless you have some need for weird flow-control over serial
connection control chars, you can recover it with
stty discard undef
And then you have ctrl-O for previous word and ctrl-T for next word.
No review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@25029 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
rewriting chunks of it along the way. No longer does columnar
output spill over and double space everything if you're unlucky
with the chosen widths. Pagination works for a higher
definition of work. Etc.
Also, for those who enjoy operating missile systems from their
repls, crash recovery now requests your permission before replaying
the session.
Closes#4194, no review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24266 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
compiler fictions.
!! You'll need a serious "ant all.clean" now. !!
As of this commit the system is fully bootstrapped and the
synthetic code eliminated: only the source files remain.
The sort-of-AnyVal-companions in scala.runtime.* have all
been eliminated because the actual companions can do everything;
deprecated vals in the scala.runtime package object point to
the companions. This left AnyValCompanion as the only AnyVal
related thing in the runtime package: that made little sense,
so I deprecated and moved it as well.
Starr is based on r24066 plus this commit. Closes#4121.
Review by rytz, odersky.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24068 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
I transitioned the jline build from maven to sbt, and this commit
includes the first sbt-built binary. Review by jsuereth.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@24055 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
sbt for a while. This changes jline not to install it, and alters
the scala startup script to trap exit and re-enable echo on
recognizably unix platforms. In addition it no longer installs
a shutdown hook to flush the repl history to disk, instead flushing
after every line.
Any bash reviewers out there? Unless someone raises a hand, no review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23909 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
IMPORTANT NOTE
Modifying code of the FJBG library is a very sensitive task since
its write operations are eg. used by the Scala compiler.
This SVN commit affects (should affect) only the read operations
(which did never work) of the FJBG library.
Changes include:
- fixed several killer bugs in the bytecode reader (see below).
- added missing input stream constructors in several Attribute classes
(eg. JBootstrapInvokeDynamic, JEnclosingMethodAttribute,
JInnerClassesAttribute) together with the corresponding class
registrations in class JAttributeFactory.
- added classes JExceptionsTable, JLocalVariableTableAttribute and
JStackMapTableAttribute (including corresponding factory methods in
class FJBGContext).
- overriden method toString in most classes to support output format
similar to javap (see below).
- did some code cleanup (tabs, etc..).
Bug fixes include:
- fixed incorrect stream.readInt() in JSourceFileAttribute constructor.
- fixed missing code.lineNumbers initialization in JLineNumberTableAttribute
constructor.
- fixed incorrect code in class util.ByteArray constructor (stream).
- added method setCode in class JMethod to link them together.
Output of decoded bytecode:
The added toString() methods return javap-like formatted strings for
the decoded data, eg. for the LocalVariableTable attribute you get the
following output:
...
LocalVariableTable:
Start Length Slot Name Signature
0 6 0 this LTest$;
0 6 1 args [Ljava/lang/String;
Executing the following Java code will produce decoded bytecode in a format
similar to the command line "javap -p -v -classpath <cpath> <classes>":
static void printClass(String filePath) throws Exception {
FJBGContext fjbgContext = new FJBGContext(49, 0);
DataInputStream in = new DataInputStream(new FileInputStream(filePath));
JClass jclass = fjbgContext.JClass(in);
System.out.println(jclass);
in.close();
}
Mainly for providing a demonstrator of the FJBG reader we added to the
FJBG library the main class ch.epfl.lamp.fjbg.Main which behaves similarly
to javap, the class file disassembler of the J2SE SDK. For instance the
following commands produce (more or less) the same output:
~$ scala ch.epfl.lamp.fjbg.Main -classpath classes 'Test$'
~$ javap -p -v -classpath classes 'Test$'
In several cases fjbg.Main will provide more information for access flags
(eg. brigde methods) and class file attributes (eg. enclosing methods).
TODO
- integration of FJBGContext.JLocalVariableTableAttribute into the JVM backend
of the Scala compiler (cleaner handling of local variables).
- The source code of the FJBG library is currently generated using the
compiler option "-source 1.4"; moving to source release 1.5 would allow
further code improvements like:
List --> List<T> (cast removals)
StringBuffer --> StringBuilder (faster implementation)
/*@Override*/ --> @Override
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
A
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23854 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
with additional code thanks to [ https://github.com/huynhjl/jline2 ].
Replaces lib/jline.jar with build of these sources, and modifies
trunk code to work with the new jar.
Hopeful improvements including baseline functionality on cygwin and
64bit windows, as well as more accurate line wrapping / cursor positioning
on all platforms and ctrl-R history search.
For the time being the canonical source repository is this:
https://github.com/paulp/jline2
The enclosed sources are a mirror of that repository, and should
be treated as read-only in the scala svn repository.
No review, codewise, but people are very strongly encouraged
to try it out and report any regressions.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23745 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
into scala.annotation and enabled the deprecated type aliases in scala.*
to point there. Also enclosed is a new starr to bootstrap. No review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23690 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
(1) the Scala types in ch.epfl.lamp.compiler.msil.emit now use Scala collections instead of Java's,
(2) a few bug fixes regarding metadata parsing,
(3) GenMSIL emits output useful for IDE debugging,
(4) TypeParser now enters symbols for generics in case the assemblies being linked sport them,
(5) a few fixes for bytecode verif in GenMSIL.
review by rytz
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23544 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
an outer name. EnclosingMethod is correctly generated.
Fixed isAnonymousClass definition. Updated test that
depends on anonymous inner class names.
Closes (again) #3249, references #2749.
review by odersky,extempore.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23507 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This should fix java signatures when they refer to
method type parameters. I unrolled Adriaans previous fix
for #3249, as this one is more general. Closes#3249,
review by moors.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23503 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
it will tell them what method was the cause. The fact that ten
files are touched in this commit instead of one or two is a testament
to the wonder of checked exceptions. No review.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23292 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
ldc being used instead of bipush or sipush. The cheaper
instructions were only being used when the argument was typed
as byte or short, but an Int in the byte or short range can as
easily use them. This also saves an entry in the constant pool.
iconst_n not being used except on Ints. Same issue in reverse:
pushing short 3 on the stack is cheaper with iconst_3 than
with sipush.
Example:
class A {
def f1: Int = 100 // was ldc #X, now bipush 100
def f2: Int = 5000 // was ldc #X, now sipush 5000
def f3: Byte = 2 // was bipush 2, now iconst_2
def f4: Short = 2 // was sipush 2, now iconst_2
}
Review by dragos.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23057 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
the least surprising option. Thanks much to Johannes Rudolph for
identifying the bug in the bytecode generator which needed addressing
for us to arrive at proper -0.0 behavior, and for writing the majority
of this patch.
A '-' followed immediately by either a number or a period should
now always be treated as a single numeric literal, which means the
minus binds more tightly than anything else. A specific example
of how this differs from 2.8 final is:
-5.+(10) == 5.0 // and not -15.0
The full range of potentially ambiguous parses involving prefix
operators, numbers, and dots is quite large and still needs to be
completely and clearly specified.
Closes#2378 and #3657, review by odersky, jrudolph.
git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@23024 5e8d7ff9-d8ef-0310-90f0-a4852d11357a