Repository navigation
Functionality changes
JDK 27 support
WALA now has basic support for reading JDK 27 class files. New bytecode features introduced in JDK 27 have not been tested.
MultiMap.removeAll now returns an empty set when the key is not present
Previously, MultiMap.removeAll(k) would return null when k was not a key
in the multi-map. Now, it returns an empty set, which is more consistent and
safer.
Assertions.UNREACHABLE now returns a generic type
The Assertions.UNREACHABLE(), Assertions.UNREACHABLE(String), and
Assertions.UNREACHABLE(Object) methods now return a generic type <T>
instead of void. This allows callers to write return Assertions.UNREACHABLE(…)
in methods that return a value, eliminating the previously required pattern of
calling Assertions.UNREACHABLE() followed by a separate return null; (or
similar unreachable-return statement).
Effect for third-party consumers:
-
Existing call sites that previously wrote:
Assertions.UNREACHABLE("message"); return null;
can now be simplified to:
return Assertions.UNREACHABLE("message");
-
Existing call sites that just call
Assertions.UNREACHABLE()as a
statement without a followingreturncontinue to work unchanged.
DFSDiscoverTimeIterator and DFSFinishTimeIterator no longer extend ArrayList
DFSDiscoverTimeIterator<T> and DFSFinishTimeIterator<T> previously
extended ArrayList<T> (in addition to implementing Iterator<T>). They
now implement only Iterator<T> and Serializable, backed by an internal
stack instead of the inherited ArrayList storage.
Effect for third-party consumers:
-
Code that called
ArrayListorListmethods on instances of these
types (e.g.size(),get(),contains(),add()) will no longer
compile. -
Code that declared variables, parameters, or return types as
ArrayList<T>orList<T>referencing these iterators will need to be
updated to useIterator<T>instead. -
Code that only consumed these types via the
Iterator<T>interface
(hasNext(),next(),forEachRemaining()) is unaffected.
Fourteen Atom methods deprecated
The following methods of com.ibm.wala.core.util.strings.Atom are now
deprecated (with @Deprecated(since = "1.9.0")). They are no longer used
anywhere within WALA itself except by correctness tests, and we do not believe
they are used anywhere outside WALA:
arrayDescriptorFromElementDescriptor()concat(byte, ImmutableByteArray)contains(byte)findOrCreate(ImmutableByteArray, int, int)findOrCreateUtf8Atom(byte[])isArrayDescriptor()isArrayDescriptor(ImmutableByteArray)isClassDescriptor()isMethodDescriptor()isReservedMemberName()left(int)parseForArrayDimensionality()parseForArrayElementDescriptor()parseForInnermostArrayElementDescriptor()
Effect for third-party consumers: if you do use any of these methods
outside WALA, please let the WALA maintainers
know so that we don't remove them in a
future release.
com.ibm.wala.util.intset.BitSet deprecated
com.ibm.wala.util.intset.BitSet<T> is now deprecated, marked
@Deprecated(since = "1.9.0"). The class has not been used anywhere within
WALA since WALA moved from Subversion to Git in April 2012, and we do not
believe it is used anywhere outside WALA. Use an IntSet
type such as MutableSparseIntSet or BitVectorIntSet, or the read-only
OrdinalSet<T>, together with an OrdinalSetMapping<T> instead.
Effect for third-party consumers: if you do use BitSet<T> outside WALA,
please let the WALA maintainers know
so that we don't remove it in a future release.
Analysis scope files may reference classes and sources packaged in JARs
In an analysis scope file, classFile and sourceFile entries previously
could only name files that exist on the filesystem. They now also work when
the named class or source file is a classpath resource, including a resource
packaged inside a JAR. For example, an entry such as
Application,Java,classFile,hello/Hello.class now resolves
hello/Hello.class via the classloader, whether it is an unpacked file or an
entry of hello.jar. This is particularly useful when running an analysis
from a single executable JAR whose supporting classes and sources are
included as entries.
Atom interning is now lock-free
The Atom interning dictionary now uses a JCTools NonBlockingHashMap
instead of a plain HashMap. The interning factories findOrCreate(byte[]),
findOrCreate(ImmutableByteArray), and the deprecated
findOrCreate(ImmutableByteArray, int, int), along with
resetDictionaryForTesting(), are no longer synchronized. The common
"already interned" lookup path is now lock-free, and when two threads race to
intern the same content, putIfAbsent ensures that only one canonical Atom
instance survives.
Effect for third-party consumers: No API changes: Atom interning still
guarantees one canonical instance per content, comparable with ==, and
remains thread-safe. Concurrent interning no longer contends on a class-level
monitor.
Many fixpoint-iteration and int-set types are now final
A number of heavily used fixpoint-iteration and int-set types are now
final where subclassing was never intended. This includes
BitVectorVariable, BooleanVariable, machine states, points-to-set
variables, etc. Marking these hot types as final gives the JIT more
freedom for devirtualization and inlining along the dataflow/fixpoint fast
path, yielding measurable performance improvements in WALA's own
benchmarks.
Effect for third-party consumers: There is no behavioral change, but the
affected classes can no longer be subclassed. If you have subclassed any of
these types, you will need to restructure your code. The affected types include:
com.ibm.wala.analysis.stackMachine.AbstractIntStackMachine.MachineStatecom.ibm.wala.cfg.exc.intra.NullPointerStatecom.ibm.wala.cfg.exc.intra.ParameterStatecom.ibm.wala.dalvik.analysis.typeInference.DalvikTypeVariablecom.ibm.wala.dalvik.ssa.AbstractIntRegisterMachine.MachineStatecom.ibm.wala.fixedpoint.impl.AbstractFixedPointSolver.Statementcom.ibm.wala.fixedpoint.impl.BasicNullaryStatementcom.ibm.wala.fixpoint.BasicUnaryStatementcom.ibm.wala.fixpoint.BitVectorVariablecom.ibm.wala.fixpoint.BooleanVariablecom.ibm.wala.ipa.callgraph.propagation.PointsToSetVariablecom.ibm.wala.util.collections.CompoundIntIteratorcom.ibm.wala.util.intset.BimodalMutableIntSetcom.ibm.wala.util.intset.EmptyIntSetcom.ibm.wala.util.intset.MutableSharedBitVectorIntSetcom.ibm.wala.util.intset.SemiSparseMutableIntSetcom.ibm.wala.util.intset.TunedMutableSparseIntSetorg.scandroid.prefixtransfer.PrefixVariable
FileUtil rewritten in terms of NIO and Guava file APIs
The methods of com.ibm.wala.util.io.FileUtil have been reimplemented on top
of java.nio.file.Files and Guava's MoreFiles, replacing hand-written
buffering, recursion, and whole-file memory mapping. All public signatures are
unchanged.
The headline fix is copy. The old implementation memory-mapped the entire
source file and wrote the resulting MappedByteBuffer to the destination. That
mapping was never unmapped, so on Windows the source file stayed locked and
delete/truncate operations against it failed until the mapping was released.
This defect is
JDK-4724038, reported on
2002-07-31 and closed as "Won't Fix" on 2023-12-06. copy now delegates to
Files.copy, which never creates a mapping and therefore never holds the source
open, and which uses the JDK's native copy (copy_file_range, sendfile, or
clonefile where the platform offers them) with constant memory use regardless
of file size.
Other changes, all bug fixes rather than performance work:
deleteContentsno longer follows symbolic links. It previously recursed
into symlinked directories becauseFile.isDirectory()follows links, which
meant it deleted the contents of whatever a symlink pointed at, and looped
forever on a symlink cycle. It now delegates to Guava's
MoreFiles.deleteDirectoryContents, which removes the link itself and cannot
recurse indefinitely.deleteContentsno longer throwsNullPointerExceptionwhen a directory
cannot be listed, and no longer throwsIOExceptionnaming the offending
path when the argument is not a directory; the latter is now a
NotDirectoryException, which is still anIOException.listFilesandrecurseFilesno longer silently treat an unlistable
directory as an empty one. Previously a directory that could not be read
contributed no entries and no error, so for example
WalaProperties.getJars()could return a quietly incomplete classpath; both
now throwUncheckedIOException.listFilesandrecurseFilesno longer follow symlinked directories while
recursing.
The remaining methods were simplified without behavioral changes:
readBytesusesInputStream.readAllBytes(),writeFileusesFiles.writeString,createFileusesMoreFiles.createParentDirectories/Files.createFile, andrecurseFilesusesFiles.walk.
Effect for third-party consumers: deleteContents deletes as much as it
can and reports every failure at the end as one IOException with the
individual failures as suppressed exceptions, where it previously stopped at
the first error. It also relies on SecureDirectoryStream where the platform
provides one, so a directory swapped for a symlink between the check and the
read cannot redirect the delete outside the tree. On a file system that
supports symlinks but not SecureDirectoryStream, it now throws
InsecureRecursiveDeleteException rather than deleting, since FileUtil does
not opt out of that check.
copy additionally differs from the old implementation in two edge cases, both
of which are improvements. If the source names a directory, it now creates an
empty directory at the destination where it previously threw IOException. If
source and destination are the same file, it is now a no-op, where it previously
truncated the file. Callers that relied on either old failure mode should check
explicitly.
readBytes retains the same ~2 GB limit, since both it and readAllBytes are
bounded by the maximum size of a Java array.
Dependency changes
:core now depends on jctools-core
The :core module now declares org.jctools:jctools-core:4.0.6 as an
implementation-scope dependency. JCTools provides the lock-free
NonBlockingHashMap used by Atom interning.
Effect for third-party consumers: The :core module now receives
jctools-core on its runtime classpath. Consumers who run WALA from a
manually assembled classpath must include jctools-core on it, or Atom
interning will fail at runtime with a NoClassDefFoundError.
Full Changelog: v1.8.0...v1.9.0