├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src ├── main ├── antlr │ ├── JavaLexer.g4 │ └── JavaParser.g4 └── kotlin │ └── com │ └── strumenta │ └── javacc │ ├── AntlrModel.kt │ ├── JavaCCLoader.kt │ └── JavaCCToAntlrConverter.kt └── test ├── kotlin └── com │ └── strumenta │ └── javacc │ ├── JavaConversion.kt │ ├── LexerTest.kt │ └── ParserTest.kt └── resources ├── guava-src └── com │ └── google │ ├── common │ ├── annotations │ │ ├── Beta.java │ │ ├── GwtCompatible.java │ │ ├── GwtIncompatible.java │ │ ├── VisibleForTesting.java │ │ └── package-info.java │ ├── base │ │ ├── Absent.java │ │ ├── AbstractIterator.java │ │ ├── Ascii.java │ │ ├── CaseFormat.java │ │ ├── CharMatcher.java │ │ ├── Charsets.java │ │ ├── CommonMatcher.java │ │ ├── CommonPattern.java │ │ ├── Converter.java │ │ ├── Defaults.java │ │ ├── Enums.java │ │ ├── Equivalence.java │ │ ├── ExtraObjectsMethodsForWeb.java │ │ ├── FinalizablePhantomReference.java │ │ ├── FinalizableReference.java │ │ ├── FinalizableReferenceQueue.java │ │ ├── FinalizableSoftReference.java │ │ ├── FinalizableWeakReference.java │ │ ├── Function.java │ │ ├── FunctionalEquivalence.java │ │ ├── Functions.java │ │ ├── JdkPattern.java │ │ ├── Joiner.java │ │ ├── MoreObjects.java │ │ ├── Objects.java │ │ ├── Optional.java │ │ ├── PairwiseEquivalence.java │ │ ├── PatternCompiler.java │ │ ├── Platform.java │ │ ├── Preconditions.java │ │ ├── Predicate.java │ │ ├── Predicates.java │ │ ├── Present.java │ │ ├── SmallCharMatcher.java │ │ ├── Splitter.java │ │ ├── StandardSystemProperty.java │ │ ├── Stopwatch.java │ │ ├── Strings.java │ │ ├── Supplier.java │ │ ├── Suppliers.java │ │ ├── Throwables.java │ │ ├── Ticker.java │ │ ├── Utf8.java │ │ ├── Verify.java │ │ ├── VerifyException.java │ │ ├── internal │ │ │ └── Finalizer.java │ │ └── package-info.java │ ├── cache │ │ ├── AbstractCache.java │ │ ├── AbstractLoadingCache.java │ │ ├── Cache.java │ │ ├── CacheBuilder.java │ │ ├── CacheBuilderSpec.java │ │ ├── CacheLoader.java │ │ ├── CacheStats.java │ │ ├── ForwardingCache.java │ │ ├── ForwardingLoadingCache.java │ │ ├── LoadingCache.java │ │ ├── LocalCache.java │ │ ├── LongAddable.java │ │ ├── LongAddables.java │ │ ├── LongAdder.java │ │ ├── ReferenceEntry.java │ │ ├── RemovalCause.java │ │ ├── RemovalListener.java │ │ ├── RemovalListeners.java │ │ ├── RemovalNotification.java │ │ ├── Striped64.java │ │ ├── Weigher.java │ │ └── package-info.java │ ├── collect │ │ ├── AbstractBiMap.java │ │ ├── AbstractIndexedListIterator.java │ │ ├── AbstractIterator.java │ │ ├── AbstractListMultimap.java │ │ ├── AbstractMapBasedMultimap.java │ │ ├── AbstractMapBasedMultiset.java │ │ ├── AbstractMapEntry.java │ │ ├── AbstractMultimap.java │ │ ├── AbstractMultiset.java │ │ ├── AbstractNavigableMap.java │ │ ├── AbstractRangeSet.java │ │ ├── AbstractSequentialIterator.java │ │ ├── AbstractSetMultimap.java │ │ ├── AbstractSortedKeySortedSetMultimap.java │ │ ├── AbstractSortedMultiset.java │ │ ├── AbstractSortedSetMultimap.java │ │ ├── AbstractTable.java │ │ ├── AllEqualOrdering.java │ │ ├── ArrayListMultimap.java │ │ ├── ArrayListMultimapGwtSerializationDependencies.java │ │ ├── ArrayTable.java │ │ ├── BiMap.java │ │ ├── BinaryTreeTraverser.java │ │ ├── BoundType.java │ │ ├── ByFunctionOrdering.java │ │ ├── CartesianList.java │ │ ├── ClassToInstanceMap.java │ │ ├── CollectCollectors.java │ │ ├── CollectPreconditions.java │ │ ├── CollectSpliterators.java │ │ ├── Collections2.java │ │ ├── CompactHashMap.java │ │ ├── CompactHashSet.java │ │ ├── CompactLinkedHashMap.java │ │ ├── CompactLinkedHashSet.java │ │ ├── ComparatorOrdering.java │ │ ├── Comparators.java │ │ ├── ComparisonChain.java │ │ ├── CompoundOrdering.java │ │ ├── ComputationException.java │ │ ├── ConcurrentHashMultiset.java │ │ ├── ConsumingQueueIterator.java │ │ ├── ContiguousSet.java │ │ ├── Count.java │ │ ├── Cut.java │ │ ├── DenseImmutableTable.java │ │ ├── DescendingImmutableSortedMultiset.java │ │ ├── DescendingImmutableSortedSet.java │ │ ├── DescendingMultiset.java │ │ ├── DiscreteDomain.java │ │ ├── EmptyContiguousSet.java │ │ ├── EmptyImmutableListMultimap.java │ │ ├── EmptyImmutableSetMultimap.java │ │ ├── EnumBiMap.java │ │ ├── EnumHashBiMap.java │ │ ├── EnumMultiset.java │ │ ├── EvictingQueue.java │ │ ├── ExplicitOrdering.java │ │ ├── FilteredEntryMultimap.java │ │ ├── FilteredEntrySetMultimap.java │ │ ├── FilteredKeyListMultimap.java │ │ ├── FilteredKeyMultimap.java │ │ ├── FilteredKeySetMultimap.java │ │ ├── FilteredMultimap.java │ │ ├── FilteredMultimapValues.java │ │ ├── FilteredSetMultimap.java │ │ ├── FluentIterable.java │ │ ├── ForwardingBlockingDeque.java │ │ ├── ForwardingCollection.java │ │ ├── ForwardingConcurrentMap.java │ │ ├── ForwardingDeque.java │ │ ├── ForwardingImmutableCollection.java │ │ ├── ForwardingImmutableList.java │ │ ├── ForwardingImmutableMap.java │ │ ├── ForwardingImmutableSet.java │ │ ├── ForwardingIterator.java │ │ ├── ForwardingList.java │ │ ├── ForwardingListIterator.java │ │ ├── ForwardingListMultimap.java │ │ ├── ForwardingMap.java │ │ ├── ForwardingMapEntry.java │ │ ├── ForwardingMultimap.java │ │ ├── ForwardingMultiset.java │ │ ├── ForwardingNavigableMap.java │ │ ├── ForwardingNavigableSet.java │ │ ├── ForwardingObject.java │ │ ├── ForwardingQueue.java │ │ ├── ForwardingSet.java │ │ ├── ForwardingSetMultimap.java │ │ ├── ForwardingSortedMap.java │ │ ├── ForwardingSortedMultiset.java │ │ ├── ForwardingSortedSet.java │ │ ├── ForwardingSortedSetMultimap.java │ │ ├── ForwardingTable.java │ │ ├── GeneralRange.java │ │ ├── GwtTransient.java │ │ ├── HashBasedTable.java │ │ ├── HashBiMap.java │ │ ├── HashMultimap.java │ │ ├── HashMultimapGwtSerializationDependencies.java │ │ ├── HashMultiset.java │ │ ├── Hashing.java │ │ ├── ImmutableAsList.java │ │ ├── ImmutableBiMap.java │ │ ├── ImmutableBiMapFauxverideShim.java │ │ ├── ImmutableClassToInstanceMap.java │ │ ├── ImmutableCollection.java │ │ ├── ImmutableEntry.java │ │ ├── ImmutableEnumMap.java │ │ ├── ImmutableEnumSet.java │ │ ├── ImmutableList.java │ │ ├── ImmutableListMultimap.java │ │ ├── ImmutableMap.java │ │ ├── ImmutableMapEntry.java │ │ ├── ImmutableMapEntrySet.java │ │ ├── ImmutableMapKeySet.java │ │ ├── ImmutableMapValues.java │ │ ├── ImmutableMultimap.java │ │ ├── ImmutableMultiset.java │ │ ├── ImmutableMultisetGwtSerializationDependencies.java │ │ ├── ImmutableRangeMap.java │ │ ├── ImmutableRangeSet.java │ │ ├── ImmutableSet.java │ │ ├── ImmutableSetMultimap.java │ │ ├── ImmutableSortedAsList.java │ │ ├── ImmutableSortedMap.java │ │ ├── ImmutableSortedMapFauxverideShim.java │ │ ├── ImmutableSortedMultiset.java │ │ ├── ImmutableSortedMultisetFauxverideShim.java │ │ ├── ImmutableSortedSet.java │ │ ├── ImmutableSortedSetFauxverideShim.java │ │ ├── ImmutableTable.java │ │ ├── Interner.java │ │ ├── Interners.java │ │ ├── Iterables.java │ │ ├── Iterators.java │ │ ├── LexicographicalOrdering.java │ │ ├── LinkedHashMultimap.java │ │ ├── LinkedHashMultimapGwtSerializationDependencies.java │ │ ├── LinkedHashMultiset.java │ │ ├── LinkedListMultimap.java │ │ ├── ListMultimap.java │ │ ├── Lists.java │ │ ├── MapDifference.java │ │ ├── MapMaker.java │ │ ├── MapMakerInternalMap.java │ │ ├── Maps.java │ │ ├── MinMaxPriorityQueue.java │ │ ├── MoreCollectors.java │ │ ├── Multimap.java │ │ ├── MultimapBuilder.java │ │ ├── Multimaps.java │ │ ├── Multiset.java │ │ ├── Multisets.java │ │ ├── MutableClassToInstanceMap.java │ │ ├── NaturalOrdering.java │ │ ├── NullsFirstOrdering.java │ │ ├── NullsLastOrdering.java │ │ ├── ObjectArrays.java │ │ ├── Ordering.java │ │ ├── PeekingIterator.java │ │ ├── Platform.java │ │ ├── Queues.java │ │ ├── Range.java │ │ ├── RangeGwtSerializationDependencies.java │ │ ├── RangeMap.java │ │ ├── RangeSet.java │ │ ├── RegularContiguousSet.java │ │ ├── RegularImmutableAsList.java │ │ ├── RegularImmutableBiMap.java │ │ ├── RegularImmutableList.java │ │ ├── RegularImmutableMap.java │ │ ├── RegularImmutableMultiset.java │ │ ├── RegularImmutableSet.java │ │ ├── RegularImmutableSortedMultiset.java │ │ ├── RegularImmutableSortedSet.java │ │ ├── RegularImmutableTable.java │ │ ├── ReverseNaturalOrdering.java │ │ ├── ReverseOrdering.java │ │ ├── RowSortedTable.java │ │ ├── Serialization.java │ │ ├── SetMultimap.java │ │ ├── Sets.java │ │ ├── SingletonImmutableBiMap.java │ │ ├── SingletonImmutableList.java │ │ ├── SingletonImmutableSet.java │ │ ├── SingletonImmutableTable.java │ │ ├── SortedIterable.java │ │ ├── SortedIterables.java │ │ ├── SortedLists.java │ │ ├── SortedMapDifference.java │ │ ├── SortedMultiset.java │ │ ├── SortedMultisetBridge.java │ │ ├── SortedMultisets.java │ │ ├── SortedSetMultimap.java │ │ ├── SparseImmutableTable.java │ │ ├── StandardRowSortedTable.java │ │ ├── StandardTable.java │ │ ├── Streams.java │ │ ├── Synchronized.java │ │ ├── Table.java │ │ ├── Tables.java │ │ ├── TopKSelector.java │ │ ├── TransformedIterator.java │ │ ├── TransformedListIterator.java │ │ ├── TreeBasedTable.java │ │ ├── TreeMultimap.java │ │ ├── TreeMultiset.java │ │ ├── TreeRangeMap.java │ │ ├── TreeRangeSet.java │ │ ├── TreeTraverser.java │ │ ├── UnmodifiableIterator.java │ │ ├── UnmodifiableListIterator.java │ │ ├── UnmodifiableSortedMultiset.java │ │ ├── UsingToStringOrdering.java │ │ ├── WellBehavedMap.java │ │ └── package-info.java │ ├── escape │ │ ├── ArrayBasedCharEscaper.java │ │ ├── ArrayBasedEscaperMap.java │ │ ├── ArrayBasedUnicodeEscaper.java │ │ ├── CharEscaper.java │ │ ├── CharEscaperBuilder.java │ │ ├── Escaper.java │ │ ├── Escapers.java │ │ ├── Platform.java │ │ ├── UnicodeEscaper.java │ │ └── package-info.java │ ├── eventbus │ │ ├── AllowConcurrentEvents.java │ │ ├── AsyncEventBus.java │ │ ├── DeadEvent.java │ │ ├── Dispatcher.java │ │ ├── EventBus.java │ │ ├── Subscribe.java │ │ ├── Subscriber.java │ │ ├── SubscriberExceptionContext.java │ │ ├── SubscriberExceptionHandler.java │ │ ├── SubscriberRegistry.java │ │ └── package-info.java │ ├── graph │ │ ├── AbstractBaseGraph.java │ │ ├── AbstractDirectedNetworkConnections.java │ │ ├── AbstractGraph.java │ │ ├── AbstractGraphBuilder.java │ │ ├── AbstractNetwork.java │ │ ├── AbstractUndirectedNetworkConnections.java │ │ ├── AbstractValueGraph.java │ │ ├── BaseGraph.java │ │ ├── ConfigurableMutableGraph.java │ │ ├── ConfigurableMutableNetwork.java │ │ ├── ConfigurableMutableValueGraph.java │ │ ├── ConfigurableNetwork.java │ │ ├── ConfigurableValueGraph.java │ │ ├── DirectedGraphConnections.java │ │ ├── DirectedMultiNetworkConnections.java │ │ ├── DirectedNetworkConnections.java │ │ ├── EdgesConnecting.java │ │ ├── ElementOrder.java │ │ ├── EndpointPair.java │ │ ├── EndpointPairIterator.java │ │ ├── ForwardingGraph.java │ │ ├── ForwardingNetwork.java │ │ ├── ForwardingValueGraph.java │ │ ├── Graph.java │ │ ├── GraphBuilder.java │ │ ├── GraphConnections.java │ │ ├── GraphConstants.java │ │ ├── Graphs.java │ │ ├── ImmutableGraph.java │ │ ├── ImmutableNetwork.java │ │ ├── ImmutableValueGraph.java │ │ ├── MapIteratorCache.java │ │ ├── MapRetrievalCache.java │ │ ├── MultiEdgesConnecting.java │ │ ├── MutableGraph.java │ │ ├── MutableNetwork.java │ │ ├── MutableValueGraph.java │ │ ├── Network.java │ │ ├── NetworkBuilder.java │ │ ├── NetworkConnections.java │ │ ├── PredecessorsFunction.java │ │ ├── SuccessorsFunction.java │ │ ├── Traverser.java │ │ ├── UndirectedGraphConnections.java │ │ ├── UndirectedMultiNetworkConnections.java │ │ ├── UndirectedNetworkConnections.java │ │ ├── ValueGraph.java │ │ ├── ValueGraphBuilder.java │ │ └── package-info.java │ ├── hash │ │ ├── AbstractByteHasher.java │ │ ├── AbstractCompositeHashFunction.java │ │ ├── AbstractHashFunction.java │ │ ├── AbstractHasher.java │ │ ├── AbstractNonStreamingHashFunction.java │ │ ├── AbstractStreamingHasher.java │ │ ├── BloomFilter.java │ │ ├── BloomFilterStrategies.java │ │ ├── ChecksumHashFunction.java │ │ ├── Crc32cHashFunction.java │ │ ├── FarmHashFingerprint64.java │ │ ├── Funnel.java │ │ ├── Funnels.java │ │ ├── HashCode.java │ │ ├── HashFunction.java │ │ ├── Hasher.java │ │ ├── Hashing.java │ │ ├── HashingInputStream.java │ │ ├── HashingOutputStream.java │ │ ├── LittleEndianByteArray.java │ │ ├── LongAddable.java │ │ ├── LongAddables.java │ │ ├── LongAdder.java │ │ ├── MacHashFunction.java │ │ ├── MessageDigestHashFunction.java │ │ ├── Murmur3_128HashFunction.java │ │ ├── Murmur3_32HashFunction.java │ │ ├── PrimitiveSink.java │ │ ├── SipHashFunction.java │ │ ├── Striped64.java │ │ └── package-info.java │ ├── html │ │ ├── HtmlEscapers.java │ │ └── package-info.java │ ├── io │ │ ├── AppendableWriter.java │ │ ├── BaseEncoding.java │ │ ├── ByteArrayDataInput.java │ │ ├── ByteArrayDataOutput.java │ │ ├── ByteProcessor.java │ │ ├── ByteSink.java │ │ ├── ByteSource.java │ │ ├── ByteStreams.java │ │ ├── CharSequenceReader.java │ │ ├── CharSink.java │ │ ├── CharSource.java │ │ ├── CharStreams.java │ │ ├── Closeables.java │ │ ├── Closer.java │ │ ├── CountingInputStream.java │ │ ├── CountingOutputStream.java │ │ ├── FileBackedOutputStream.java │ │ ├── FileWriteMode.java │ │ ├── Files.java │ │ ├── Flushables.java │ │ ├── InsecureRecursiveDeleteException.java │ │ ├── LineBuffer.java │ │ ├── LineProcessor.java │ │ ├── LineReader.java │ │ ├── LittleEndianDataInputStream.java │ │ ├── LittleEndianDataOutputStream.java │ │ ├── MoreFiles.java │ │ ├── MultiInputStream.java │ │ ├── MultiReader.java │ │ ├── PatternFilenameFilter.java │ │ ├── ReaderInputStream.java │ │ ├── RecursiveDeleteOption.java │ │ ├── Resources.java │ │ └── package-info.java │ ├── math │ │ ├── BigIntegerMath.java │ │ ├── DoubleMath.java │ │ ├── DoubleUtils.java │ │ ├── IntMath.java │ │ ├── LinearTransformation.java │ │ ├── LongMath.java │ │ ├── MathPreconditions.java │ │ ├── PairedStats.java │ │ ├── PairedStatsAccumulator.java │ │ ├── Quantiles.java │ │ ├── Stats.java │ │ ├── StatsAccumulator.java │ │ └── package-info.java │ ├── net │ │ ├── HostAndPort.java │ │ ├── HostSpecifier.java │ │ ├── HttpHeaders.java │ │ ├── InetAddresses.java │ │ ├── InternetDomainName.java │ │ ├── MediaType.java │ │ ├── PercentEscaper.java │ │ ├── UrlEscapers.java │ │ └── package-info.java │ ├── primitives │ │ ├── Booleans.java │ │ ├── Bytes.java │ │ ├── Chars.java │ │ ├── Doubles.java │ │ ├── Floats.java │ │ ├── ImmutableDoubleArray.java │ │ ├── ImmutableIntArray.java │ │ ├── ImmutableLongArray.java │ │ ├── Ints.java │ │ ├── Longs.java │ │ ├── ParseRequest.java │ │ ├── Primitives.java │ │ ├── Shorts.java │ │ ├── SignedBytes.java │ │ ├── UnsignedBytes.java │ │ ├── UnsignedInteger.java │ │ ├── UnsignedInts.java │ │ ├── UnsignedLong.java │ │ ├── UnsignedLongs.java │ │ └── package-info.java │ ├── reflect │ │ ├── AbstractInvocationHandler.java │ │ ├── ClassPath.java │ │ ├── Element.java │ │ ├── ImmutableTypeToInstanceMap.java │ │ ├── Invokable.java │ │ ├── MutableTypeToInstanceMap.java │ │ ├── Parameter.java │ │ ├── Reflection.java │ │ ├── TypeCapture.java │ │ ├── TypeParameter.java │ │ ├── TypeResolver.java │ │ ├── TypeToInstanceMap.java │ │ ├── TypeToken.java │ │ ├── TypeVisitor.java │ │ ├── Types.java │ │ └── package-info.java │ ├── util │ │ └── concurrent │ │ │ ├── AbstractCatchingFuture.java │ │ │ ├── AbstractCheckedFuture.java │ │ │ ├── AbstractExecutionThreadService.java │ │ │ ├── AbstractFuture.java │ │ │ ├── AbstractIdleService.java │ │ │ ├── AbstractListeningExecutorService.java │ │ │ ├── AbstractScheduledService.java │ │ │ ├── AbstractService.java │ │ │ ├── AbstractTransformFuture.java │ │ │ ├── AggregateFuture.java │ │ │ ├── AggregateFutureState.java │ │ │ ├── AsyncCallable.java │ │ │ ├── AsyncFunction.java │ │ │ ├── AtomicDouble.java │ │ │ ├── AtomicDoubleArray.java │ │ │ ├── AtomicLongMap.java │ │ │ ├── Atomics.java │ │ │ ├── Callables.java │ │ │ ├── CheckedFuture.java │ │ │ ├── CollectionFuture.java │ │ │ ├── CombinedFuture.java │ │ │ ├── CycleDetectingLockFactory.java │ │ │ ├── ExecutionError.java │ │ │ ├── ExecutionList.java │ │ │ ├── FakeTimeLimiter.java │ │ │ ├── FluentFuture.java │ │ │ ├── ForwardingBlockingDeque.java │ │ │ ├── ForwardingBlockingQueue.java │ │ │ ├── ForwardingCheckedFuture.java │ │ │ ├── ForwardingCondition.java │ │ │ ├── ForwardingExecutorService.java │ │ │ ├── ForwardingFluentFuture.java │ │ │ ├── ForwardingFuture.java │ │ │ ├── ForwardingListenableFuture.java │ │ │ ├── ForwardingListeningExecutorService.java │ │ │ ├── ForwardingLock.java │ │ │ ├── FutureCallback.java │ │ │ ├── Futures.java │ │ │ ├── FuturesGetChecked.java │ │ │ ├── GwtFluentFutureCatchingSpecialization.java │ │ │ ├── GwtFuturesCatchingSpecialization.java │ │ │ ├── ImmediateFuture.java │ │ │ ├── InterruptibleTask.java │ │ │ ├── JdkFutureAdapters.java │ │ │ ├── ListenableFuture.java │ │ │ ├── ListenableFutureTask.java │ │ │ ├── ListenableScheduledFuture.java │ │ │ ├── ListenerCallQueue.java │ │ │ ├── ListeningExecutorService.java │ │ │ ├── ListeningScheduledExecutorService.java │ │ │ ├── Monitor.java │ │ │ ├── MoreExecutors.java │ │ │ ├── Partially.java │ │ │ ├── Platform.java │ │ │ ├── RateLimiter.java │ │ │ ├── Runnables.java │ │ │ ├── SequentialExecutor.java │ │ │ ├── Service.java │ │ │ ├── ServiceManager.java │ │ │ ├── SettableFuture.java │ │ │ ├── SimpleTimeLimiter.java │ │ │ ├── SmoothRateLimiter.java │ │ │ ├── Striped.java │ │ │ ├── ThreadFactoryBuilder.java │ │ │ ├── TimeLimiter.java │ │ │ ├── TimeoutFuture.java │ │ │ ├── TrustedListenableFutureTask.java │ │ │ ├── UncaughtExceptionHandlers.java │ │ │ ├── UncheckedExecutionException.java │ │ │ ├── UncheckedTimeoutException.java │ │ │ ├── Uninterruptibles.java │ │ │ ├── WrappingExecutorService.java │ │ │ ├── WrappingScheduledExecutorService.java │ │ │ └── package-info.java │ └── xml │ │ ├── XmlEscapers.java │ │ └── package-info.java │ └── thirdparty │ └── publicsuffix │ ├── PublicSuffixPatterns.java │ ├── PublicSuffixType.java │ └── TrieParser.java ├── java.jj ├── lexer ├── CaseInsensitiveLexer.g4 ├── MultiStateTokensLexer.g4 ├── PushPopStateFuncsLexer.g4 ├── UnnamedTokensLexer.g4 ├── caseInsensitive.jj ├── multiStateTokens.jj ├── pushPopStateFuncs.jj └── unnamedTokens.jj └── parser ├── BasicsParser.g4 └── basics.jj /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | .DS_Store 3 | bin 4 | build 5 | out 6 | *.iml 7 | *.ipr 8 | *.iws 9 | generated-src 10 | .idea 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | before_install: 5 | - chmod +x gradlew 6 | - chmod +x gradle/wrapper/gradle-wrapper.jar 7 | script: 8 | - ./gradlew test build -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.0' 3 | 4 | repositories { 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | plugins { 14 | id "org.jetbrains.kotlin.jvm" version "$kotlin_version" 15 | id 'java' 16 | id 'antlr' 17 | id 'idea' 18 | id 'application' 19 | } 20 | 21 | repositories { 22 | mavenLocal() 23 | mavenCentral() 24 | } 25 | 26 | project.group = "com.strumenta" 27 | project.version = "0.1" 28 | 29 | mainClassName = "com.strumenta.javacc.JavaCCToAntlrConverter" 30 | 31 | dependencies { 32 | antlr 'org.antlr:antlr4:4.9.3' 33 | implementation 'org.antlr:antlr4-runtime:4.9.3' 34 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 35 | implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" 36 | implementation 'me.tomassetti:kolasu:0.2.2' 37 | testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version" 38 | testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" 39 | testImplementation 'junit:junit:4.13.2' 40 | testImplementation 'org.slf4j:slf4j-simple:1.7.25' 41 | 42 | implementation group: 'net.java.dev.javacc', name: 'javacc', version: '7.0.3' 43 | implementation 'com.github.julianthome:inmemantlr-api:1.7.0' 44 | } 45 | 46 | generateGrammarSource { 47 | maxHeapSize = "64m" 48 | arguments += ['-package', 'com.strumenta.javacc'] 49 | outputDirectory = new File("generated-src/antlr/main/com/strumenta/javacc".toString()) 50 | } 51 | sourceSets { 52 | generated { 53 | java.srcDir 'generated-src/antlr/main/' 54 | } 55 | } 56 | compileGeneratedJava.enabled false 57 | compileGeneratedKotlin.enabled false 58 | compileJava { 59 | dependsOn generateGrammarSource 60 | source sourceSets.generated.java, sourceSets.main.java 61 | } 62 | compileKotlin { 63 | dependsOn generateGrammarSource 64 | dependsOn generateGeneratedGrammarSource 65 | source sourceSets.generated.java, sourceSets.main.java, sourceSets.main.kotlin 66 | } 67 | 68 | clean { 69 | delete "generated-src" 70 | } 71 | 72 | idea { 73 | module { 74 | //sourceDirs += file("generated-src/antlr/main") 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ftomassetti/JavaCC2ANTLR/b5ef703f58791b5d2ab069d7eaa737526f5f84f4/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Nov 22 16:53:06 CET 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip 7 | -------------------------------------------------------------------------------- /src/test/kotlin/com/strumenta/javacc/LexerTest.kt: -------------------------------------------------------------------------------- 1 | package com.strumenta.javacc 2 | 3 | import org.javacc.parser.Main as javacc 4 | import org.junit.Before 5 | import org.junit.Test 6 | import java.io.File 7 | import kotlin.test.assertEquals 8 | 9 | class LexerTest { 10 | 11 | @Before 12 | fun setup() { 13 | javacc.reInitAll() 14 | } 15 | 16 | companion object { 17 | fun runTest(fileBaseName: String) { 18 | val file = File("src/test/resources/lexer/$fileBaseName.jj") 19 | val grammarName = file.nameWithoutExtension.replaceFirstChar(Char::titlecase) 20 | val javaCCGrammar = loadJavaCCGrammar(file) 21 | val antlrGrammar = javaCCGrammar.convertToAntlr(grammarName) 22 | val expectedLexerFilename = fileBaseName[0].uppercase() + fileBaseName.substring(1) + "Lexer.g4" 23 | val expectedLexer = File("src/test/resources/lexer/$expectedLexerFilename").inputStream().readBytes().toString(Charsets.UTF_8) 24 | assertEquals(expectedLexer, antlrGrammar.lexerDefinitions.generate()) 25 | } 26 | } 27 | 28 | @Test 29 | fun pushPopStateFuncs() { 30 | runTest("pushPopStateFuncs") 31 | } 32 | 33 | @Test 34 | fun unnamedTokens() { 35 | runTest("unnamedTokens") 36 | } 37 | 38 | @Test 39 | fun multiStateTokens() { 40 | runTest("multiStateTokens") 41 | } 42 | 43 | @Test 44 | fun caseInsensitive() { 45 | // Note that unlike the other letters, rule A does not get generated as a fragment since there 46 | // is a real rule matching that literal (e.g. for parsing HTML tags) 47 | runTest("caseInsensitive") 48 | } 49 | } -------------------------------------------------------------------------------- /src/test/kotlin/com/strumenta/javacc/ParserTest.kt: -------------------------------------------------------------------------------- 1 | package com.strumenta.javacc 2 | 3 | import org.javacc.parser.Main 4 | import org.junit.Before 5 | import org.junit.Test 6 | import java.io.File 7 | import kotlin.test.assertEquals 8 | 9 | class ParserTest { 10 | 11 | @Before 12 | fun setup() { 13 | Main.reInitAll() 14 | } 15 | 16 | companion object { 17 | fun runTest(fileBaseName: String) { 18 | val file = File("src/test/resources/parser/$fileBaseName.jj") 19 | val grammarName = file.nameWithoutExtension.replaceFirstChar(Char::titlecase) 20 | val javaCCGrammar = loadJavaCCGrammar(file) 21 | val antlrGrammar = javaCCGrammar.convertToAntlr(grammarName) 22 | val expectedLexerFilename = fileBaseName[0].uppercase() + fileBaseName.substring(1) + "Parser.g4" 23 | val expectedLexer = File("src/test/resources/parser/$expectedLexerFilename").inputStream().readBytes().toString(Charsets.UTF_8) 24 | assertEquals(expectedLexer, antlrGrammar.parserDefinitions.generate(antlrGrammar.lexerDefinitions.name)) 25 | } 26 | } 27 | 28 | @Test 29 | fun basics() { 30 | runTest("basics") 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/annotations/Beta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.annotations; 16 | 17 | import java.lang.annotation.Documented; 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * Signifies that a public API (public class, method or field) is subject to incompatible changes, 25 | * or even removal, in a future release. An API bearing this annotation is exempt from any 26 | * compatibility guarantees made by its containing library. Note that the presence of this 27 | * annotation implies nothing about the quality or performance of the API in question, only the fact 28 | * that it is not "API-frozen." 29 | * 30 | *

It is generally safe for applications to depend on beta APIs, at the cost of some extra 31 | * work during upgrades. However it is generally inadvisable for libraries (which get 32 | * included on users' CLASSPATHs, outside the library developers' control) to do so. 33 | * 34 | * 35 | * @author Kevin Bourrillion 36 | */ 37 | @Retention(RetentionPolicy.CLASS) 38 | @Target({ 39 | ElementType.ANNOTATION_TYPE, 40 | ElementType.CONSTRUCTOR, 41 | ElementType.FIELD, 42 | ElementType.METHOD, 43 | ElementType.TYPE 44 | }) 45 | @Documented 46 | @GwtCompatible 47 | public @interface Beta {} 48 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/annotations/GwtIncompatible.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.annotations; 16 | 17 | import java.lang.annotation.Documented; 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * The presence of this annotation on an API indicates that the method may not be used with 25 | * the Google Web Toolkit (GWT). 26 | * 27 | *

This annotation behaves identically to the 29 | * {@code @GwtIncompatible} annotation in GWT itself. 30 | * 31 | * @author Charles Fry 32 | */ 33 | @Retention(RetentionPolicy.CLASS) 34 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) 35 | @Documented 36 | @GwtCompatible 37 | public @interface GwtIncompatible { 38 | /** 39 | * Describes why the annotated element is incompatible with GWT. Since this is generally due to a 40 | * dependence on a type/method which GWT doesn't support, it is sufficient to simply reference the 41 | * unsupported type/method. E.g. "Class.isInstance". 42 | * 43 | *

As of Guava 20.0, this value is optional. We encourage authors who wish to describe why an 44 | * API is {@code @GwtIncompatible} to instead leave an implementation comment. 45 | */ 46 | String value() default ""; 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/annotations/VisibleForTesting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.annotations; 16 | 17 | /** 18 | * Annotates a program element that exists, or is more widely visible than otherwise necessary, only 19 | * for use in test code. 20 | * 21 | * @author Johannes Henkel 22 | */ 23 | @GwtCompatible 24 | public @interface VisibleForTesting { 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/annotations/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Common annotation types. This package is a part of the open-source Guava library. 18 | */ 19 | package com.google.common.annotations; 20 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/CommonMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * The subset of the {@link java.util.regex.Matcher} API which is used by this package, and also 21 | * shared with the {@code re2j} library. For internal use only. Please refer to the {@code Matcher} 22 | * javadoc for details. 23 | */ 24 | @GwtCompatible 25 | abstract class CommonMatcher { 26 | abstract boolean matches(); 27 | 28 | abstract boolean find(); 29 | 30 | abstract boolean find(int index); 31 | 32 | abstract String replaceAll(String replacement); 33 | 34 | abstract int end(); 35 | 36 | abstract int start(); 37 | } 38 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/CommonPattern.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * The subset of the {@link java.util.regex.Pattern} API which is used by this package, and also 21 | * shared with the {@code re2j} library. For internal use only. Please refer to the {@code Pattern} 22 | * javadoc for details. 23 | */ 24 | @GwtCompatible 25 | abstract class CommonPattern { 26 | abstract CommonMatcher matcher(CharSequence t); 27 | 28 | abstract String pattern(); 29 | 30 | abstract int flags(); 31 | 32 | // Re-declare these as abstract to force subclasses to override. 33 | @Override 34 | public abstract String toString(); 35 | 36 | @Override 37 | public abstract int hashCode(); 38 | 39 | @Override 40 | public abstract boolean equals(Object o); 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/Defaults.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import static com.google.common.base.Preconditions.checkNotNull; 18 | 19 | import com.google.common.annotations.GwtIncompatible; 20 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 21 | 22 | /** 23 | * This class provides default values for all Java types, as defined by the JLS. 24 | * 25 | * @author Ben Yu 26 | * @since 1.0 27 | */ 28 | @GwtIncompatible 29 | public final class Defaults { 30 | private Defaults() {} 31 | 32 | private static final Double DOUBLE_DEFAULT = Double.valueOf(0d); 33 | private static final Float FLOAT_DEFAULT = Float.valueOf(0f); 34 | 35 | /** 36 | * Returns the default value of {@code type} as defined by JLS --- {@code 0} for numbers, {@code 37 | * false} for {@code boolean} and {@code '\0'} for {@code char}. For non-primitive types and 38 | * {@code void}, {@code null} is returned. 39 | */ 40 | @NullableDecl 41 | @SuppressWarnings("unchecked") 42 | public static T defaultValue(Class type) { 43 | checkNotNull(type); 44 | if (type == boolean.class) { 45 | return (T) Boolean.FALSE; 46 | } else if (type == char.class) { 47 | return (T) Character.valueOf('\0'); 48 | } else if (type == byte.class) { 49 | return (T) Byte.valueOf((byte) 0); 50 | } else if (type == short.class) { 51 | return (T) Short.valueOf((short) 0); 52 | } else if (type == int.class) { 53 | return (T) Integer.valueOf(0); 54 | } else if (type == long.class) { 55 | return (T) Long.valueOf(0L); 56 | } else if (type == float.class) { 57 | return (T) FLOAT_DEFAULT; 58 | } else if (type == double.class) { 59 | return (T) DOUBLE_DEFAULT; 60 | } else { 61 | return null; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/ExtraObjectsMethodsForWeb.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Holder for extra methods of {@code Objects} only in web. Intended to be empty for regular 21 | * version. 22 | */ 23 | @GwtCompatible(emulated = true) 24 | abstract class ExtraObjectsMethodsForWeb {} 25 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/FinalizablePhantomReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | import java.lang.ref.PhantomReference; 19 | import java.lang.ref.ReferenceQueue; 20 | 21 | /** 22 | * Phantom reference with a {@code finalizeReferent()} method which a background thread invokes 23 | * after the garbage collector reclaims the referent. This is a simpler alternative to using a 24 | * {@link ReferenceQueue}. 25 | * 26 | *

Unlike a normal phantom reference, this reference will be cleared automatically. 27 | * 28 | * @author Bob Lee 29 | * @since 2.0 30 | */ 31 | @GwtIncompatible 32 | public abstract class FinalizablePhantomReference extends PhantomReference 33 | implements FinalizableReference { 34 | /** 35 | * Constructs a new finalizable phantom reference. 36 | * 37 | * @param referent to phantom reference 38 | * @param queue that should finalize the referent 39 | */ 40 | protected FinalizablePhantomReference(T referent, FinalizableReferenceQueue queue) { 41 | super(referent, queue.queue); 42 | queue.cleanUp(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/FinalizableReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | 19 | /** 20 | * Implemented by references that have code to run after garbage collection of their referents. 21 | * 22 | * @see FinalizableReferenceQueue 23 | * @author Bob Lee 24 | * @since 2.0 25 | */ 26 | @GwtIncompatible 27 | public interface FinalizableReference { 28 | /** 29 | * Invoked on a background thread after the referent has been garbage collected unless security 30 | * restrictions prevented starting a background thread, in which case this method is invoked when 31 | * new references are created. 32 | */ 33 | void finalizeReferent(); 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/FinalizableSoftReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | import java.lang.ref.ReferenceQueue; 19 | import java.lang.ref.SoftReference; 20 | 21 | /** 22 | * Soft reference with a {@code finalizeReferent()} method which a background thread invokes after 23 | * the garbage collector reclaims the referent. This is a simpler alternative to using a {@link 24 | * ReferenceQueue}. 25 | * 26 | * @author Bob Lee 27 | * @since 2.0 28 | */ 29 | @GwtIncompatible 30 | public abstract class FinalizableSoftReference extends SoftReference 31 | implements FinalizableReference { 32 | /** 33 | * Constructs a new finalizable soft reference. 34 | * 35 | * @param referent to softly reference 36 | * @param queue that should finalize the referent 37 | */ 38 | protected FinalizableSoftReference(T referent, FinalizableReferenceQueue queue) { 39 | super(referent, queue.queue); 40 | queue.cleanUp(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/FinalizableWeakReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | import java.lang.ref.ReferenceQueue; 19 | import java.lang.ref.WeakReference; 20 | 21 | /** 22 | * Weak reference with a {@code finalizeReferent()} method which a background thread invokes after 23 | * the garbage collector reclaims the referent. This is a simpler alternative to using a {@link 24 | * ReferenceQueue}. 25 | * 26 | * @author Bob Lee 27 | * @since 2.0 28 | */ 29 | @GwtIncompatible 30 | public abstract class FinalizableWeakReference extends WeakReference 31 | implements FinalizableReference { 32 | /** 33 | * Constructs a new finalizable weak reference. 34 | * 35 | * @param referent to weakly reference 36 | * @param queue that should finalize the referent 37 | */ 38 | protected FinalizableWeakReference(T referent, FinalizableReferenceQueue queue) { 39 | super(referent, queue.queue); 40 | queue.cleanUp(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/PatternCompiler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | 19 | /** 20 | * Pluggable interface for compiling a regex pattern. By default this package uses the {@code 21 | * java.util.regex} library, but an alternate implementation can be supplied using the {@link 22 | * java.util.ServiceLoader} mechanism. 23 | */ 24 | @GwtIncompatible 25 | interface PatternCompiler { 26 | /** 27 | * Compiles the given pattern. 28 | * 29 | * @throws IllegalArgumentException if the pattern is invalid 30 | */ 31 | CommonPattern compile(String pattern); 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/Supplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 19 | 20 | /** 21 | * Legacy version of {@link java.util.function.Supplier java.util.function.Supplier}. Semantically, 22 | * this could be a factory, generator, builder, closure, or something else entirely. No guarantees 23 | * are implied by this interface. 24 | * 25 | *

The {@link Suppliers} class provides common suppliers and related utilities. 26 | * 27 | *

As this interface extends {@code java.util.function.Supplier}, an instance of this type can be 28 | * used as a {@code java.util.function.Supplier} directly. To use a {@code 29 | * java.util.function.Supplier} in a context where a {@code com.google.common.base.Supplier} is 30 | * needed, use {@code supplier::get}. 31 | * 32 | *

See the Guava User Guide article on the use of {@code Function}. 34 | * 35 | * @author Harry Heymann 36 | * @since 2.0 37 | */ 38 | @GwtCompatible 39 | @FunctionalInterface 40 | public interface Supplier extends java.util.function.Supplier { 41 | /** 42 | * Retrieves an instance of the appropriate type. The returned object may or may not be a new 43 | * instance, depending on the implementation. 44 | * 45 | * @return an instance of the appropriate type 46 | */ 47 | @CanIgnoreReturnValue 48 | @Override 49 | T get(); 50 | } 51 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/Ticker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtCompatible; 19 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 20 | 21 | /** 22 | * A time source; returns a time value representing the number of nanoseconds elapsed since some 23 | * fixed but arbitrary point in time. Note that most users should use {@link Stopwatch} instead of 24 | * interacting with this class directly. 25 | * 26 | *

Warning: this interface can only be used to measure elapsed time, not wall time. 27 | * 28 | * @author Kevin Bourrillion 29 | * @since 10.0 (mostly 30 | * source-compatible since 9.0) 31 | */ 32 | @Beta 33 | @GwtCompatible 34 | public abstract class Ticker { 35 | /** Constructor for use by subclasses. */ 36 | protected Ticker() {} 37 | 38 | /** Returns the number of nanoseconds elapsed since this ticker's fixed point of reference. */ 39 | @CanIgnoreReturnValue // TODO(kak): Consider removing this 40 | public abstract long read(); 41 | 42 | /** 43 | * A ticker that reads the current time using {@link System#nanoTime}. 44 | * 45 | * @since 10.0 46 | */ 47 | public static Ticker systemTicker() { 48 | return SYSTEM_TICKER; 49 | } 50 | 51 | private static final Ticker SYSTEM_TICKER = 52 | new Ticker() { 53 | @Override 54 | public long read() { 55 | return Platform.systemNanoTime(); 56 | } 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/VerifyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.base; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 19 | 20 | /** 21 | * Exception thrown upon the failure of a verification check, 23 | * including those performed by the convenience methods of the {@link Verify} class. 24 | * 25 | * @since 17.0 26 | */ 27 | @GwtCompatible 28 | public class VerifyException extends RuntimeException { 29 | /** Constructs a {@code VerifyException} with no message. */ 30 | public VerifyException() {} 31 | 32 | /** Constructs a {@code VerifyException} with the message {@code message}. */ 33 | public VerifyException(@NullableDecl String message) { 34 | super(message); 35 | } 36 | 37 | /** 38 | * Constructs a {@code VerifyException} with the cause {@code cause} and a message that is {@code 39 | * null} if {@code cause} is null, and {@code cause.toString()} otherwise. 40 | * 41 | * @since 19.0 42 | */ 43 | public VerifyException(@NullableDecl Throwable cause) { 44 | super(cause); 45 | } 46 | 47 | /** 48 | * Constructs a {@code VerifyException} with the message {@code message} and the cause {@code 49 | * cause}. 50 | * 51 | * @since 19.0 52 | */ 53 | public VerifyException(@NullableDecl String message, @NullableDecl Throwable cause) { 54 | super(message, cause); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/base/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Basic utility libraries and interfaces. 17 | * 18 | *

This package is a part of the open-source Guava 19 | * library. 20 | * 21 | *

Contents

22 | * 23 | *

String-related utilities

24 | * 25 | * 34 | * 35 | *

Function types

36 | * 37 | * 44 | * 45 | *

Other

46 | * 47 | * 56 | * 57 | */ 58 | @CheckReturnValue 59 | @ParametersAreNonnullByDefault 60 | package com.google.common.base; 61 | 62 | import com.google.errorprone.annotations.CheckReturnValue; 63 | import javax.annotation.ParametersAreNonnullByDefault; 64 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/cache/LongAddable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.cache; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Abstract interface for objects that can concurrently add longs. 21 | * 22 | * @author Louis Wasserman 23 | */ 24 | @GwtCompatible 25 | interface LongAddable { 26 | void increment(); 27 | 28 | void add(long x); 29 | 30 | long sum(); 31 | } 32 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/cache/LongAddables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.cache; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import com.google.common.base.Supplier; 19 | import java.util.concurrent.atomic.AtomicLong; 20 | 21 | /** 22 | * Source of {@link LongAddable} objects that deals with GWT, Unsafe, and all that. 23 | * 24 | * @author Louis Wasserman 25 | */ 26 | @GwtCompatible(emulated = true) 27 | final class LongAddables { 28 | private static final Supplier SUPPLIER; 29 | 30 | static { 31 | Supplier supplier; 32 | try { 33 | new LongAdder(); // trigger static initialization of the LongAdder class, which may fail 34 | supplier = 35 | new Supplier() { 36 | @Override 37 | public LongAddable get() { 38 | return new LongAdder(); 39 | } 40 | }; 41 | } catch (Throwable t) { // we really want to catch *everything* 42 | supplier = 43 | new Supplier() { 44 | @Override 45 | public LongAddable get() { 46 | return new PureJavaLongAddable(); 47 | } 48 | }; 49 | } 50 | SUPPLIER = supplier; 51 | } 52 | 53 | public static LongAddable create() { 54 | return SUPPLIER.get(); 55 | } 56 | 57 | private static final class PureJavaLongAddable extends AtomicLong implements LongAddable { 58 | @Override 59 | public void increment() { 60 | getAndIncrement(); 61 | } 62 | 63 | @Override 64 | public void add(long x) { 65 | getAndAdd(x); 66 | } 67 | 68 | @Override 69 | public long sum() { 70 | return get(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/cache/RemovalListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.cache; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * An object that can receive a notification when an entry is removed from a cache. The removal 21 | * resulting in notification could have occurred to an entry being manually removed or replaced, or 22 | * due to eviction resulting from timed expiration, exceeding a maximum size, or garbage collection. 23 | * 24 | *

An instance may be called concurrently by multiple threads to process different entries. 25 | * Implementations of this interface should avoid performing blocking calls or synchronizing on 26 | * shared resources. 27 | * 28 | * @param the most general type of keys this listener can listen for; for example {@code Object} 29 | * if any key is acceptable 30 | * @param the most general type of values this listener can listen for; for example {@code 31 | * Object} if any key is acceptable 32 | * @author Charles Fry 33 | * @since 10.0 34 | */ 35 | @GwtCompatible 36 | @FunctionalInterface 37 | public interface RemovalListener { 38 | /** 39 | * Notifies the listener that a removal occurred at some point in the past. 40 | * 41 | *

This does not always signify that the key is now absent from the cache, as it may have 42 | * already been re-added. 43 | */ 44 | // Technically should accept RemovalNotification, but because 45 | // RemovalNotification is guaranteed covariant, let's make users' lives simpler. 46 | void onRemoval(RemovalNotification notification); 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/cache/RemovalListeners.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.cache; 16 | 17 | import static com.google.common.base.Preconditions.checkNotNull; 18 | 19 | import com.google.common.annotations.GwtIncompatible; 20 | import java.util.concurrent.Executor; 21 | 22 | /** 23 | * A collection of common removal listeners. 24 | * 25 | * @author Charles Fry 26 | * @since 10.0 27 | */ 28 | @GwtIncompatible 29 | public final class RemovalListeners { 30 | 31 | private RemovalListeners() {} 32 | 33 | /** 34 | * Returns a {@code RemovalListener} which processes all eviction notifications using {@code 35 | * executor}. 36 | * 37 | * @param listener the backing listener 38 | * @param executor the executor with which removal notifications are asynchronously executed 39 | */ 40 | public static RemovalListener asynchronous( 41 | final RemovalListener listener, final Executor executor) { 42 | checkNotNull(listener); 43 | checkNotNull(executor); 44 | return new RemovalListener() { 45 | @Override 46 | public void onRemoval(final RemovalNotification notification) { 47 | executor.execute( 48 | new Runnable() { 49 | @Override 50 | public void run() { 51 | listener.onRemoval(notification); 52 | } 53 | }); 54 | } 55 | }; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/cache/Weigher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.cache; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Calculates the weights of cache entries. 21 | * 22 | * @author Charles Fry 23 | * @since 11.0 24 | */ 25 | @GwtCompatible 26 | @FunctionalInterface 27 | public interface Weigher { 28 | 29 | /** 30 | * Returns the weight of a cache entry. There is no unit for entry weights; rather they are simply 31 | * relative to each other. 32 | * 33 | * @return the weight of the entry; must be non-negative 34 | */ 35 | int weigh(K key, V value); 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/cache/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * This package contains caching utilities. 17 | * 18 | *

The core interface used to represent caches is {@link com.google.common.cache.Cache}. 19 | * In-memory caches can be configured and created using {@link 20 | * com.google.common.cache.CacheBuilder}, with cache entries being loaded by {@link 21 | * com.google.common.cache.CacheLoader}. Statistics about cache performance are exposed using {@link 22 | * com.google.common.cache.CacheStats}. 23 | * 24 | *

See the Guava User Guide article on caches. 26 | * 27 | *

This package is a part of the open-source Guava 28 | * library. 29 | * 30 | * @author Charles Fry 31 | */ 32 | @ParametersAreNonnullByDefault 33 | package com.google.common.cache; 34 | 35 | import javax.annotation.ParametersAreNonnullByDefault; 36 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/AbstractMapEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.common.base.Objects; 21 | import java.util.Map.Entry; 22 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 23 | 24 | /** 25 | * Implementation of the {@code equals}, {@code hashCode}, and {@code toString} methods of {@code 26 | * Entry}. 27 | * 28 | * @author Jared Levy 29 | */ 30 | @GwtCompatible 31 | abstract class AbstractMapEntry implements Entry { 32 | 33 | @Override 34 | public abstract K getKey(); 35 | 36 | @Override 37 | public abstract V getValue(); 38 | 39 | @Override 40 | public V setValue(V value) { 41 | throw new UnsupportedOperationException(); 42 | } 43 | 44 | @Override 45 | public boolean equals(@NullableDecl Object object) { 46 | if (object instanceof Entry) { 47 | Entry that = (Entry) object; 48 | return Objects.equal(this.getKey(), that.getKey()) 49 | && Objects.equal(this.getValue(), that.getValue()); 50 | } 51 | return false; 52 | } 53 | 54 | @Override 55 | public int hashCode() { 56 | K k = getKey(); 57 | V v = getValue(); 58 | return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode()); 59 | } 60 | 61 | /** Returns a string representation of the form {@code {key}={value}}. */ 62 | @Override 63 | public String toString() { 64 | return getKey() + "=" + getValue(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/AbstractSortedKeySortedSetMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Collection; 21 | import java.util.SortedMap; 22 | import java.util.SortedSet; 23 | 24 | /** 25 | * Basic implementation of a {@link SortedSetMultimap} with a sorted key set. 26 | * 27 | *

This superclass allows {@code TreeMultimap} to override methods to return navigable set and 28 | * map types in non-GWT only, while GWT code will inherit the SortedMap/SortedSet overrides. 29 | * 30 | * @author Louis Wasserman 31 | */ 32 | @GwtCompatible 33 | abstract class AbstractSortedKeySortedSetMultimap extends AbstractSortedSetMultimap { 34 | 35 | AbstractSortedKeySortedSetMultimap(SortedMap> map) { 36 | super(map); 37 | } 38 | 39 | @Override 40 | public SortedMap> asMap() { 41 | return (SortedMap>) super.asMap(); 42 | } 43 | 44 | @Override 45 | SortedMap> backingMap() { 46 | return (SortedMap>) super.backingMap(); 47 | } 48 | 49 | @Override 50 | public SortedSet keySet() { 51 | return (SortedSet) super.keySet(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/AllEqualOrdering.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.io.Serializable; 21 | import java.util.List; 22 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 23 | 24 | /** 25 | * An ordering that treats all references as equals, even nulls. 26 | * 27 | * @author Emily Soldal 28 | */ 29 | @GwtCompatible(serializable = true) 30 | final class AllEqualOrdering extends Ordering implements Serializable { 31 | static final AllEqualOrdering INSTANCE = new AllEqualOrdering(); 32 | 33 | @Override 34 | public int compare(@NullableDecl Object left, @NullableDecl Object right) { 35 | return 0; 36 | } 37 | 38 | @Override 39 | public List sortedCopy(Iterable iterable) { 40 | return Lists.newArrayList(iterable); 41 | } 42 | 43 | @Override 44 | public ImmutableList immutableSortedCopy(Iterable iterable) { 45 | return ImmutableList.copyOf(iterable); 46 | } 47 | 48 | @SuppressWarnings("unchecked") 49 | @Override 50 | public Ordering reverse() { 51 | return (Ordering) this; 52 | } 53 | 54 | private Object readResolve() { 55 | return INSTANCE; 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | return "Ordering.allEqual()"; 61 | } 62 | 63 | private static final long serialVersionUID = 0; 64 | } 65 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ArrayListMultimapGwtSerializationDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Collection; 21 | import java.util.Map; 22 | 23 | /** 24 | * A dummy superclass to support GWT serialization of the element types of an {@link 25 | * ArrayListMultimap}. The GWT supersource for this class contains a field for each type. 26 | * 27 | *

For details about this hack, see {@link GwtSerializationDependencies}, which takes the same 28 | * approach but with a subclass rather than a superclass. 29 | * 30 | *

TODO(cpovirk): Consider applying this subclass approach to our other types. 31 | */ 32 | @GwtCompatible(emulated = true) 33 | abstract class ArrayListMultimapGwtSerializationDependencies 34 | extends AbstractListMultimap { 35 | ArrayListMultimapGwtSerializationDependencies(Map> map) { 36 | super(map); 37 | } 38 | // TODO(cpovirk): Maybe I should have just one shared superclass for AbstractMultimap itself? 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/BoundType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.collect; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Indicates whether an endpoint of some range is contained in the range itself ("closed") or not 21 | * ("open"). If a range is unbounded on a side, it is neither open nor closed on that side; the 22 | * bound simply does not exist. 23 | * 24 | * @since 10.0 25 | */ 26 | @GwtCompatible 27 | public enum BoundType { 28 | /** The endpoint value is not considered part of the set ("exclusive"). */ 29 | OPEN(false), 30 | CLOSED(true); 31 | 32 | final boolean inclusive; 33 | 34 | BoundType(boolean inclusive) { 35 | this.inclusive = inclusive; 36 | } 37 | 38 | /** Returns the bound type corresponding to a boolean value for inclusivity. */ 39 | static BoundType forBoolean(boolean inclusive) { 40 | return inclusive ? CLOSED : OPEN; 41 | } 42 | 43 | BoundType flip() { 44 | return forBoolean(!inclusive); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ByFunctionOrdering.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import static com.google.common.base.Preconditions.checkNotNull; 20 | 21 | import com.google.common.annotations.GwtCompatible; 22 | import com.google.common.base.Function; 23 | import com.google.common.base.Objects; 24 | import java.io.Serializable; 25 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 26 | 27 | /** 28 | * An ordering that orders elements by applying an order to the result of a function on those 29 | * elements. 30 | */ 31 | @GwtCompatible(serializable = true) 32 | final class ByFunctionOrdering extends Ordering implements Serializable { 33 | final Function function; 34 | final Ordering ordering; 35 | 36 | ByFunctionOrdering(Function function, Ordering ordering) { 37 | this.function = checkNotNull(function); 38 | this.ordering = checkNotNull(ordering); 39 | } 40 | 41 | @Override 42 | public int compare(F left, F right) { 43 | return ordering.compare(function.apply(left), function.apply(right)); 44 | } 45 | 46 | @Override 47 | public boolean equals(@NullableDecl Object object) { 48 | if (object == this) { 49 | return true; 50 | } 51 | if (object instanceof ByFunctionOrdering) { 52 | ByFunctionOrdering that = (ByFunctionOrdering) object; 53 | return this.function.equals(that.function) && this.ordering.equals(that.ordering); 54 | } 55 | return false; 56 | } 57 | 58 | @Override 59 | public int hashCode() { 60 | return Objects.hashCode(function, ordering); 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return ordering + ".onResultOf(" + function + ")"; 66 | } 67 | 68 | private static final long serialVersionUID = 0; 69 | } 70 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/CollectPreconditions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import static com.google.common.base.Preconditions.checkState; 20 | 21 | import com.google.common.annotations.GwtCompatible; 22 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 23 | 24 | /** Precondition checks useful in collection implementations. */ 25 | @GwtCompatible 26 | final class CollectPreconditions { 27 | 28 | static void checkEntryNotNull(Object key, Object value) { 29 | if (key == null) { 30 | throw new NullPointerException("null key in entry: null=" + value); 31 | } else if (value == null) { 32 | throw new NullPointerException("null value in entry: " + key + "=null"); 33 | } 34 | } 35 | 36 | @CanIgnoreReturnValue 37 | static int checkNonnegative(int value, String name) { 38 | if (value < 0) { 39 | throw new IllegalArgumentException(name + " cannot be negative but was: " + value); 40 | } 41 | return value; 42 | } 43 | 44 | @CanIgnoreReturnValue 45 | static long checkNonnegative(long value, String name) { 46 | if (value < 0) { 47 | throw new IllegalArgumentException(name + " cannot be negative but was: " + value); 48 | } 49 | return value; 50 | } 51 | 52 | static void checkPositive(int value, String name) { 53 | if (value <= 0) { 54 | throw new IllegalArgumentException(name + " must be positive but was: " + value); 55 | } 56 | } 57 | 58 | /** 59 | * Precondition tester for {@code Iterator.remove()} that throws an exception with a consistent 60 | * error message. 61 | */ 62 | static void checkRemove(boolean canRemove) { 63 | checkState(canRemove, "no calls to next() since the last call to remove()"); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ComparatorOrdering.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import static com.google.common.base.Preconditions.checkNotNull; 20 | 21 | import com.google.common.annotations.GwtCompatible; 22 | import java.io.Serializable; 23 | import java.util.Comparator; 24 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 25 | 26 | /** An ordering for a pre-existing comparator. */ 27 | @GwtCompatible(serializable = true) 28 | final class ComparatorOrdering extends Ordering implements Serializable { 29 | final Comparator comparator; 30 | 31 | ComparatorOrdering(Comparator comparator) { 32 | this.comparator = checkNotNull(comparator); 33 | } 34 | 35 | @Override 36 | public int compare(T a, T b) { 37 | return comparator.compare(a, b); 38 | } 39 | 40 | @Override 41 | public boolean equals(@NullableDecl Object object) { 42 | if (object == this) { 43 | return true; 44 | } 45 | if (object instanceof ComparatorOrdering) { 46 | ComparatorOrdering that = (ComparatorOrdering) object; 47 | return this.comparator.equals(that.comparator); 48 | } 49 | return false; 50 | } 51 | 52 | @Override 53 | public int hashCode() { 54 | return comparator.hashCode(); 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return comparator.toString(); 60 | } 61 | 62 | private static final long serialVersionUID = 0; 63 | } 64 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/CompoundOrdering.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.io.Serializable; 21 | import java.util.Arrays; 22 | import java.util.Comparator; 23 | 24 | /** An ordering that tries several comparators in order. */ 25 | @GwtCompatible(serializable = true) 26 | final class CompoundOrdering extends Ordering implements Serializable { 27 | final Comparator[] comparators; 28 | 29 | CompoundOrdering(Comparator primary, Comparator secondary) { 30 | this.comparators = (Comparator[]) new Comparator[] {primary, secondary}; 31 | } 32 | 33 | CompoundOrdering(Iterable> comparators) { 34 | this.comparators = Iterables.toArray(comparators, new Comparator[0]); 35 | } 36 | 37 | @Override 38 | public int compare(T left, T right) { 39 | for (int i = 0; i < comparators.length; i++) { 40 | int result = comparators[i].compare(left, right); 41 | if (result != 0) { 42 | return result; 43 | } 44 | } 45 | return 0; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object object) { 50 | if (object == this) { 51 | return true; 52 | } 53 | if (object instanceof CompoundOrdering) { 54 | CompoundOrdering that = (CompoundOrdering) object; 55 | return Arrays.equals(this.comparators, that.comparators); 56 | } 57 | return false; 58 | } 59 | 60 | @Override 61 | public int hashCode() { 62 | return Arrays.hashCode(comparators); 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return "Ordering.compound(" + Arrays.toString(comparators) + ")"; 68 | } 69 | 70 | private static final long serialVersionUID = 0; 71 | } 72 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ComputationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 21 | 22 | /** 23 | * Wraps an exception that occurred during a computation. 24 | * 25 | * @author Bob Lee 26 | * @since 2.0 27 | */ 28 | @GwtCompatible 29 | public class ComputationException extends RuntimeException { 30 | /** Creates a new instance with the given cause. */ 31 | public ComputationException(@NullableDecl Throwable cause) { 32 | super(cause); 33 | } 34 | 35 | private static final long serialVersionUID = 0; 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ConsumingQueueIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.collect; 16 | 17 | import static com.google.common.base.Preconditions.checkNotNull; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.ArrayDeque; 21 | import java.util.Collections; 22 | import java.util.Queue; 23 | 24 | /** 25 | * An Iterator implementation which draws elements from a queue, removing them from the queue as it 26 | * iterates. 27 | */ 28 | @GwtCompatible 29 | class ConsumingQueueIterator extends AbstractIterator { 30 | private final Queue queue; 31 | 32 | ConsumingQueueIterator(T... elements) { 33 | this.queue = new ArrayDeque(elements.length); 34 | Collections.addAll(queue, elements); 35 | } 36 | 37 | ConsumingQueueIterator(Queue queue) { 38 | this.queue = checkNotNull(queue); 39 | } 40 | 41 | @Override 42 | public T computeNext() { 43 | return queue.isEmpty() ? endOfData() : queue.remove(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/Count.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the 10 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 11 | * express or implied. See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.google.common.collect; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import java.io.Serializable; 19 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 20 | 21 | /** 22 | * A mutable value of type {@code int}, for multisets to use in tracking counts of values. 23 | * 24 | * @author Louis Wasserman 25 | */ 26 | @GwtCompatible 27 | final class Count implements Serializable { 28 | private int value; 29 | 30 | Count(int value) { 31 | this.value = value; 32 | } 33 | 34 | public int get() { 35 | return value; 36 | } 37 | 38 | public void add(int delta) { 39 | value += delta; 40 | } 41 | 42 | public int addAndGet(int delta) { 43 | return value += delta; 44 | } 45 | 46 | public void set(int newValue) { 47 | value = newValue; 48 | } 49 | 50 | public int getAndSet(int newValue) { 51 | int result = value; 52 | value = newValue; 53 | return result; 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | return value; 59 | } 60 | 61 | @Override 62 | public boolean equals(@NullableDecl Object obj) { 63 | return obj instanceof Count && ((Count) obj).value == value; 64 | } 65 | 66 | @Override 67 | public String toString() { 68 | return Integer.toString(value); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/EmptyImmutableListMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * Implementation of {@link ImmutableListMultimap} with no entries. 23 | * 24 | * @author Jared Levy 25 | */ 26 | @GwtCompatible(serializable = true) 27 | class EmptyImmutableListMultimap extends ImmutableListMultimap { 28 | static final EmptyImmutableListMultimap INSTANCE = new EmptyImmutableListMultimap(); 29 | 30 | private EmptyImmutableListMultimap() { 31 | super(ImmutableMap.>of(), 0); 32 | } 33 | 34 | private Object readResolve() { 35 | return INSTANCE; // preserve singleton property 36 | } 37 | 38 | private static final long serialVersionUID = 0; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/EmptyImmutableSetMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * Implementation of {@link ImmutableListMultimap} with no entries. 23 | * 24 | * @author Mike Ward 25 | */ 26 | @GwtCompatible(serializable = true) 27 | class EmptyImmutableSetMultimap extends ImmutableSetMultimap { 28 | static final EmptyImmutableSetMultimap INSTANCE = new EmptyImmutableSetMultimap(); 29 | 30 | private EmptyImmutableSetMultimap() { 31 | super(ImmutableMap.>of(), 0, null); 32 | } 33 | 34 | private Object readResolve() { 35 | return INSTANCE; // preserve singleton property 36 | } 37 | 38 | private static final long serialVersionUID = 0; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ExplicitOrdering.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.io.Serializable; 21 | import java.util.List; 22 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 23 | 24 | /** An ordering that compares objects according to a given order. */ 25 | @GwtCompatible(serializable = true) 26 | final class ExplicitOrdering extends Ordering implements Serializable { 27 | final ImmutableMap rankMap; 28 | 29 | ExplicitOrdering(List valuesInOrder) { 30 | this(Maps.indexMap(valuesInOrder)); 31 | } 32 | 33 | ExplicitOrdering(ImmutableMap rankMap) { 34 | this.rankMap = rankMap; 35 | } 36 | 37 | @Override 38 | public int compare(T left, T right) { 39 | return rank(left) - rank(right); // safe because both are nonnegative 40 | } 41 | 42 | private int rank(T value) { 43 | Integer rank = rankMap.get(value); 44 | if (rank == null) { 45 | throw new IncomparableValueException(value); 46 | } 47 | return rank; 48 | } 49 | 50 | @Override 51 | public boolean equals(@NullableDecl Object object) { 52 | if (object instanceof ExplicitOrdering) { 53 | ExplicitOrdering that = (ExplicitOrdering) object; 54 | return this.rankMap.equals(that.rankMap); 55 | } 56 | return false; 57 | } 58 | 59 | @Override 60 | public int hashCode() { 61 | return rankMap.hashCode(); 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "Ordering.explicit(" + rankMap.keySet() + ")"; 67 | } 68 | 69 | private static final long serialVersionUID = 0; 70 | } 71 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/FilteredEntrySetMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.common.base.Predicate; 21 | import java.util.Map.Entry; 22 | import java.util.Set; 23 | 24 | /** 25 | * Implementation of {@link Multimaps#filterEntries(SetMultimap, Predicate)}. 26 | * 27 | * @author Louis Wasserman 28 | */ 29 | @GwtCompatible 30 | final class FilteredEntrySetMultimap extends FilteredEntryMultimap 31 | implements FilteredSetMultimap { 32 | 33 | FilteredEntrySetMultimap(SetMultimap unfiltered, Predicate> predicate) { 34 | super(unfiltered, predicate); 35 | } 36 | 37 | @Override 38 | public SetMultimap unfiltered() { 39 | return (SetMultimap) unfiltered; 40 | } 41 | 42 | @Override 43 | public Set get(K key) { 44 | return (Set) super.get(key); 45 | } 46 | 47 | @Override 48 | public Set removeAll(Object key) { 49 | return (Set) super.removeAll(key); 50 | } 51 | 52 | @Override 53 | public Set replaceValues(K key, Iterable values) { 54 | return (Set) super.replaceValues(key, values); 55 | } 56 | 57 | @Override 58 | Set> createEntries() { 59 | return Sets.filter(unfiltered().entries(), entryPredicate()); 60 | } 61 | 62 | @Override 63 | public Set> entries() { 64 | return (Set>) super.entries(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/FilteredKeyListMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.common.base.Predicate; 21 | import java.util.List; 22 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 23 | 24 | /** 25 | * Implementation of {@link Multimaps#filterKeys(ListMultimap, Predicate)}. 26 | * 27 | * @author Louis Wasserman 28 | */ 29 | @GwtCompatible 30 | final class FilteredKeyListMultimap extends FilteredKeyMultimap 31 | implements ListMultimap { 32 | FilteredKeyListMultimap(ListMultimap unfiltered, Predicate keyPredicate) { 33 | super(unfiltered, keyPredicate); 34 | } 35 | 36 | @Override 37 | public ListMultimap unfiltered() { 38 | return (ListMultimap) super.unfiltered(); 39 | } 40 | 41 | @Override 42 | public List get(K key) { 43 | return (List) super.get(key); 44 | } 45 | 46 | @Override 47 | public List removeAll(@NullableDecl Object key) { 48 | return (List) super.removeAll(key); 49 | } 50 | 51 | @Override 52 | public List replaceValues(K key, Iterable values) { 53 | return (List) super.replaceValues(key, values); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/FilteredMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.common.base.Predicate; 21 | import java.util.Map.Entry; 22 | 23 | /** 24 | * An interface for all filtered multimap types. 25 | * 26 | * @author Louis Wasserman 27 | */ 28 | @GwtCompatible 29 | interface FilteredMultimap extends Multimap { 30 | Multimap unfiltered(); 31 | 32 | Predicate> entryPredicate(); 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/FilteredSetMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * A supertype for filtered {@link SetMultimap} implementations. 23 | * 24 | * @author Louis Wasserman 25 | */ 26 | @GwtCompatible 27 | interface FilteredSetMultimap extends FilteredMultimap, SetMultimap { 28 | @Override 29 | SetMultimap unfiltered(); 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingImmutableCollection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * Dummy class that makes the GWT serialization policy happy. It isn't used on the server-side. 23 | * 24 | * @author Hayward Chan 25 | */ 26 | @GwtCompatible(emulated = true) 27 | class ForwardingImmutableCollection { 28 | private ForwardingImmutableCollection() {} 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingImmutableList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * Unused stub class, unreferenced under Java and manually emulated under GWT. 23 | * 24 | * @author Chris Povirk 25 | */ 26 | @GwtCompatible(emulated = true) 27 | abstract class ForwardingImmutableList { 28 | private ForwardingImmutableList() {} 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingImmutableMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * Unused stub class, unreferenced under Java and manually emulated under GWT. 23 | * 24 | * @author Chris Povirk 25 | */ 26 | @GwtCompatible(emulated = true) 27 | abstract class ForwardingImmutableMap { 28 | private ForwardingImmutableMap() {} 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingImmutableSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * Unused stub class, unreferenced under Java and manually emulated under GWT. 23 | * 24 | * @author Chris Povirk 25 | */ 26 | @GwtCompatible(emulated = true) 27 | abstract class ForwardingImmutableSet { 28 | private ForwardingImmutableSet() {} 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 21 | import java.util.Iterator; 22 | 23 | /** 24 | * An iterator which forwards all its method calls to another iterator. Subclasses should override 25 | * one or more methods to modify the behavior of the backing iterator as desired per the decorator pattern. 27 | * 28 | *

{@code default} method warning: This class forwards calls to only some {@code 29 | * default} methods. Specifically, it forwards calls only for methods that existed before {@code default} 31 | * methods were introduced. For newer methods, like {@code forEachRemaining}, it inherits their 32 | * default implementations. When those implementations invoke methods, they invoke methods on the 33 | * {@code ForwardingIterator}. 34 | * 35 | * @author Kevin Bourrillion 36 | * @since 2.0 37 | */ 38 | @GwtCompatible 39 | public abstract class ForwardingIterator extends ForwardingObject implements Iterator { 40 | 41 | /** Constructor for use by subclasses. */ 42 | protected ForwardingIterator() {} 43 | 44 | @Override 45 | protected abstract Iterator delegate(); 46 | 47 | @Override 48 | public boolean hasNext() { 49 | return delegate().hasNext(); 50 | } 51 | 52 | @CanIgnoreReturnValue 53 | @Override 54 | public T next() { 55 | return delegate().next(); 56 | } 57 | 58 | @Override 59 | public void remove() { 60 | delegate().remove(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingListMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 21 | import java.util.List; 22 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 23 | 24 | /** 25 | * A list multimap which forwards all its method calls to another list multimap. Subclasses should 26 | * override one or more methods to modify the behavior of the backing multimap as desired per the decorator pattern. 28 | * 29 | *

{@code default} method warning: This class does not forward calls to {@code 30 | * default} methods. Instead, it inherits their default implementations. When those implementations 31 | * invoke methods, they invoke methods on the {@code ForwardingListMultimap}. 32 | * 33 | * @author Kurt Alfred Kluever 34 | * @since 3.0 35 | */ 36 | @GwtCompatible 37 | public abstract class ForwardingListMultimap extends ForwardingMultimap 38 | implements ListMultimap { 39 | 40 | /** Constructor for use by subclasses. */ 41 | protected ForwardingListMultimap() {} 42 | 43 | @Override 44 | protected abstract ListMultimap delegate(); 45 | 46 | @Override 47 | public List get(@NullableDecl K key) { 48 | return delegate().get(key); 49 | } 50 | 51 | @CanIgnoreReturnValue 52 | @Override 53 | public List removeAll(@NullableDecl Object key) { 54 | return delegate().removeAll(key); 55 | } 56 | 57 | @CanIgnoreReturnValue 58 | @Override 59 | public List replaceValues(K key, Iterable values) { 60 | return delegate().replaceValues(key, values); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ForwardingSetMultimap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 21 | import java.util.Map.Entry; 22 | import java.util.Set; 23 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 24 | 25 | /** 26 | * A set multimap which forwards all its method calls to another set multimap. Subclasses should 27 | * override one or more methods to modify the behavior of the backing multimap as desired per the decorator pattern. 29 | * 30 | *

{@code default} method warning: This class does not forward calls to {@code 31 | * default} methods. Instead, it inherits their default implementations. When those implementations 32 | * invoke methods, they invoke methods on the {@code ForwardingSetMultimap}. 33 | * 34 | * @author Kurt Alfred Kluever 35 | * @since 3.0 36 | */ 37 | @GwtCompatible 38 | public abstract class ForwardingSetMultimap extends ForwardingMultimap 39 | implements SetMultimap { 40 | 41 | @Override 42 | protected abstract SetMultimap delegate(); 43 | 44 | @Override 45 | public Set> entries() { 46 | return delegate().entries(); 47 | } 48 | 49 | @Override 50 | public Set get(@NullableDecl K key) { 51 | return delegate().get(key); 52 | } 53 | 54 | @CanIgnoreReturnValue 55 | @Override 56 | public Set removeAll(@NullableDecl Object key) { 57 | return delegate().removeAll(key); 58 | } 59 | 60 | @CanIgnoreReturnValue 61 | @Override 62 | public Set replaceValues(K key, Iterable values) { 63 | return delegate().replaceValues(key, values); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/GwtTransient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import static java.lang.annotation.ElementType.FIELD; 20 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 21 | 22 | import com.google.common.annotations.GwtCompatible; 23 | import java.lang.annotation.Documented; 24 | import java.lang.annotation.Retention; 25 | import java.lang.annotation.Target; 26 | 27 | /** 28 | * Private replacement for {@link com.google.gwt.user.client.rpc.GwtTransient} to work around 29 | * build-system quirks. This annotation should be used only in {@code 30 | * com.google.common.collect}. 31 | */ 32 | @Documented 33 | @GwtCompatible 34 | @Retention(RUNTIME) 35 | @Target(FIELD) 36 | @interface GwtTransient {} 37 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/HashMultimapGwtSerializationDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Collection; 21 | import java.util.Map; 22 | 23 | /** 24 | * A dummy superclass to support GWT serialization of the element types of a {@link HashMultimap}. 25 | * The GWT supersource for this class contains a field for each type. 26 | * 27 | *

For details about this hack, see {@link GwtSerializationDependencies}, which takes the same 28 | * approach but with a subclass rather than a superclass. 29 | * 30 | *

TODO(cpovirk): Consider applying this subclass approach to our other types. 31 | */ 32 | @GwtCompatible(emulated = true) 33 | abstract class HashMultimapGwtSerializationDependencies extends AbstractSetMultimap { 34 | HashMultimapGwtSerializationDependencies(Map> map) { 35 | super(map); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ImmutableEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.io.Serializable; 21 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 22 | 23 | /** @see com.google.common.collect.Maps#immutableEntry(Object, Object) */ 24 | @GwtCompatible(serializable = true) 25 | class ImmutableEntry extends AbstractMapEntry implements Serializable { 26 | final K key; 27 | final V value; 28 | 29 | ImmutableEntry(@NullableDecl K key, @NullableDecl V value) { 30 | this.key = key; 31 | this.value = value; 32 | } 33 | 34 | @NullableDecl 35 | @Override 36 | public final K getKey() { 37 | return key; 38 | } 39 | 40 | @NullableDecl 41 | @Override 42 | public final V getValue() { 43 | return value; 44 | } 45 | 46 | @Override 47 | public final V setValue(V value) { 48 | throw new UnsupportedOperationException(); 49 | } 50 | 51 | private static final long serialVersionUID = 0; 52 | } 53 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/ImmutableMultisetGwtSerializationDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | 21 | /** 22 | * A dummy superclass to support GWT serialization of the element type of an {@link 23 | * ImmutableMultiset}. The GWT supersource for this class contains a field of type {@code E}. 24 | * 25 | *

For details about this hack, see {@link GwtSerializationDependencies}, which takes the same 26 | * approach but with a subclass rather than a superclass. 27 | * 28 | *

TODO(cpovirk): Consider applying this subclass approach to our other types. 29 | * 30 | *

For {@code ImmutableMultiset} in particular, I ran into a problem with the {@code 31 | * GwtSerializationDependencies} approach: When autogenerating a serializer for the new class, GWT 32 | * tries to refer to our dummy serializer for the superclass, 33 | * ImmutableMultiset_CustomFieldSerializer. But that type has no methods (since it's never actually 34 | * used). We could probably fix the problem by adding dummy methods to that class, but that is 35 | * starting to sound harder than taking the superclass approach, which I've been coming to like, 36 | * anyway, since it doesn't require us to declare dummy methods (though occasionally constructors) 37 | * and make types non-final. 38 | */ 39 | @GwtCompatible(emulated = true) 40 | abstract class ImmutableMultisetGwtSerializationDependencies extends ImmutableCollection {} 41 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/Interner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.Beta; 20 | import com.google.common.annotations.GwtIncompatible; 21 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 22 | 23 | /** 24 | * Provides equivalent behavior to {@link String#intern} for other immutable types. Common 25 | * implementations are available from the {@link Interners} class. 26 | * 27 | * @author Kevin Bourrillion 28 | * @since 3.0 29 | */ 30 | @Beta 31 | @GwtIncompatible 32 | public interface Interner { 33 | /** 34 | * Chooses and returns the representative instance for any of a collection of instances that are 35 | * equal to each other. If two {@linkplain Object#equals equal} inputs are given to this method, 36 | * both calls will return the same instance. That is, {@code intern(a).equals(a)} always holds, 37 | * and {@code intern(a) == intern(b)} if and only if {@code a.equals(b)}. Note that {@code 38 | * intern(a)} is permitted to return one instance now and a different instance later if the 39 | * original interned instance was garbage-collected. 40 | * 41 | *

Warning: do not use with mutable objects. 42 | * 43 | * @throws NullPointerException if {@code sample} is null 44 | */ 45 | @CanIgnoreReturnValue // TODO(cpovirk): Consider removing this? 46 | E intern(E sample); 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/LinkedHashMultimapGwtSerializationDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Collection; 21 | import java.util.Map; 22 | 23 | /** 24 | * A dummy superclass to support GWT serialization of the element types of a {@link 25 | * LinkedHashMultimap}. The GWT supersource for this class contains a field for each type. 26 | * 27 | *

For details about this hack, see {@link GwtSerializationDependencies}, which takes the same 28 | * approach but with a subclass rather than a superclass. 29 | * 30 | *

TODO(cpovirk): Consider applying this subclass approach to our other types. 31 | */ 32 | @GwtCompatible(emulated = true) 33 | abstract class LinkedHashMultimapGwtSerializationDependencies 34 | extends AbstractSetMultimap { 35 | LinkedHashMultimapGwtSerializationDependencies(Map> map) { 36 | super(map); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/Platform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.lang.reflect.Array; 21 | 22 | /** 23 | * Methods factored out so that they can be emulated differently in GWT. 24 | * 25 | * @author Hayward Chan 26 | */ 27 | @GwtCompatible(emulated = true) 28 | final class Platform { 29 | /** 30 | * Returns a new array of the given length with the same type as a reference array. 31 | * 32 | * @param reference any array of the desired type 33 | * @param length the length of the new array 34 | */ 35 | static T[] newArray(T[] reference, int length) { 36 | Class type = reference.getClass().getComponentType(); 37 | 38 | // the cast is safe because 39 | // result.getClass() == reference.getClass().getComponentType() 40 | @SuppressWarnings("unchecked") 41 | T[] result = (T[]) Array.newInstance(type, length); 42 | return result; 43 | } 44 | 45 | /** 46 | * Configures the given map maker to use weak keys, if possible; does nothing otherwise (i.e., in 47 | * GWT). This is sometimes acceptable, when only server-side code could generate enough volume 48 | * that reclamation becomes important. 49 | */ 50 | static MapMaker tryWeakKeys(MapMaker mapMaker) { 51 | return mapMaker.weakKeys(); 52 | } 53 | 54 | static int reduceIterationsIfGwt(int iterations) { 55 | return iterations; 56 | } 57 | 58 | static int reduceExponentIfGwt(int exponent) { 59 | return exponent; 60 | } 61 | 62 | private Platform() {} 63 | } 64 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/RangeGwtSerializationDependencies.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.io.Serializable; 21 | 22 | /** 23 | * A dummy superclass to support GWT serialization of the element type of a {@link Range}. The GWT 24 | * supersource for this class contains a field of type {@code C}. 25 | * 26 | *

For details about this hack, see {@link GwtSerializationDependencies}, which takes the same 27 | * approach but with a subclass rather than a superclass. 28 | * 29 | *

TODO(cpovirk): Consider applying this subclass approach to our other types. 30 | */ 31 | @GwtCompatible(emulated = true) 32 | abstract class RangeGwtSerializationDependencies implements Serializable {} 33 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/RowSortedTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Map; 21 | import java.util.Set; 22 | import java.util.SortedMap; 23 | import java.util.SortedSet; 24 | 25 | /** 26 | * Interface that extends {@code Table} and whose rows are sorted. 27 | * 28 | *

The {@link #rowKeySet} method returns a {@link SortedSet} and the {@link #rowMap} method 29 | * returns a {@link SortedMap}, instead of the {@link Set} and {@link Map} specified by the {@link 30 | * Table} interface. 31 | * 32 | * @author Warren Dukes 33 | * @since 8.0 34 | */ 35 | @GwtCompatible 36 | public interface RowSortedTable extends Table { 37 | /** 38 | * {@inheritDoc} 39 | * 40 | *

This method returns a {@link SortedSet}, instead of the {@code Set} specified in the {@link 41 | * Table} interface. 42 | */ 43 | @Override 44 | SortedSet rowKeySet(); 45 | 46 | /** 47 | * {@inheritDoc} 48 | * 49 | *

This method returns a {@link SortedMap}, instead of the {@code Map} specified in the {@link 50 | * Table} interface. 51 | */ 52 | @Override 53 | SortedMap> rowMap(); 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/SingletonImmutableList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import static com.google.common.base.Preconditions.checkNotNull; 20 | 21 | import com.google.common.annotations.GwtCompatible; 22 | import com.google.common.base.Preconditions; 23 | import java.util.Collections; 24 | import java.util.Spliterator; 25 | 26 | /** 27 | * Implementation of {@link ImmutableList} with exactly one element. 28 | * 29 | * @author Hayward Chan 30 | */ 31 | @GwtCompatible(serializable = true, emulated = true) 32 | @SuppressWarnings("serial") // uses writeReplace(), not default serialization 33 | final class SingletonImmutableList extends ImmutableList { 34 | 35 | final transient E element; 36 | 37 | SingletonImmutableList(E element) { 38 | this.element = checkNotNull(element); 39 | } 40 | 41 | @Override 42 | public E get(int index) { 43 | Preconditions.checkElementIndex(index, 1); 44 | return element; 45 | } 46 | 47 | @Override 48 | public UnmodifiableIterator iterator() { 49 | return Iterators.singletonIterator(element); 50 | } 51 | 52 | @Override 53 | public Spliterator spliterator() { 54 | return Collections.singleton(element).spliterator(); 55 | } 56 | 57 | @Override 58 | public int size() { 59 | return 1; 60 | } 61 | 62 | @Override 63 | public ImmutableList subList(int fromIndex, int toIndex) { 64 | Preconditions.checkPositionIndexes(fromIndex, toIndex, 1); 65 | return (fromIndex == toIndex) ? ImmutableList.of() : this; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return '[' + element.toString() + ']'; 71 | } 72 | 73 | @Override 74 | boolean isPartialView() { 75 | return false; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/SortedIterable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the 10 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 11 | * express or implied. See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.google.common.collect; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import java.util.Comparator; 19 | import java.util.Iterator; 20 | 21 | /** 22 | * An {@code Iterable} whose elements are sorted relative to a {@code Comparator}, typically 23 | * provided at creation time. 24 | * 25 | * @author Louis Wasserman 26 | */ 27 | @GwtCompatible 28 | interface SortedIterable extends Iterable { 29 | /** 30 | * Returns the {@code Comparator} by which the elements of this iterable are ordered, or {@code 31 | * Ordering.natural()} if the elements are ordered by their natural ordering. 32 | */ 33 | Comparator comparator(); 34 | 35 | /** 36 | * Returns an iterator over elements of type {@code T}. The elements are returned in nondecreasing 37 | * order according to the associated {@link #comparator}. 38 | */ 39 | @Override 40 | Iterator iterator(); 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/SortedIterables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the 10 | * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 11 | * express or implied. See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package com.google.common.collect; 16 | 17 | import static com.google.common.base.Preconditions.checkNotNull; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Comparator; 21 | import java.util.SortedSet; 22 | 23 | /** 24 | * Utilities for dealing with sorted collections of all types. 25 | * 26 | * @author Louis Wasserman 27 | */ 28 | @GwtCompatible 29 | final class SortedIterables { 30 | private SortedIterables() {} 31 | 32 | /** 33 | * Returns {@code true} if {@code elements} is a sorted collection using an ordering equivalent to 34 | * {@code comparator}. 35 | */ 36 | public static boolean hasSameComparator(Comparator comparator, Iterable elements) { 37 | checkNotNull(comparator); 38 | checkNotNull(elements); 39 | Comparator comparator2; 40 | if (elements instanceof SortedSet) { 41 | comparator2 = comparator((SortedSet) elements); 42 | } else if (elements instanceof SortedIterable) { 43 | comparator2 = ((SortedIterable) elements).comparator(); 44 | } else { 45 | return false; 46 | } 47 | return comparator.equals(comparator2); 48 | } 49 | 50 | @SuppressWarnings("unchecked") 51 | // if sortedSet.comparator() is null, the set must be naturally ordered 52 | public static Comparator comparator(SortedSet sortedSet) { 53 | Comparator result = sortedSet.comparator(); 54 | if (result == null) { 55 | result = (Comparator) Ordering.natural(); 56 | } 57 | return result; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/SortedMapDifference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.SortedMap; 21 | 22 | /** 23 | * An object representing the differences between two sorted maps. 24 | * 25 | * @author Louis Wasserman 26 | * @since 8.0 27 | */ 28 | @GwtCompatible 29 | public interface SortedMapDifference extends MapDifference { 30 | 31 | @Override 32 | SortedMap entriesOnlyOnLeft(); 33 | 34 | @Override 35 | SortedMap entriesOnlyOnRight(); 36 | 37 | @Override 38 | SortedMap entriesInCommon(); 39 | 40 | @Override 41 | SortedMap> entriesDiffering(); 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/SortedMultisetBridge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtIncompatible; 20 | import java.util.SortedSet; 21 | 22 | /** 23 | * Superinterface of {@link SortedMultiset} to introduce a bridge method for {@code elementSet()}, 24 | * to ensure binary compatibility with older Guava versions that specified {@code elementSet()} to 25 | * return {@code SortedSet}. 26 | * 27 | * @author Louis Wasserman 28 | */ 29 | @GwtIncompatible 30 | interface SortedMultisetBridge extends Multiset { 31 | @Override 32 | SortedSet elementSet(); 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/TransformedIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import static com.google.common.base.Preconditions.checkNotNull; 20 | 21 | import com.google.common.annotations.GwtCompatible; 22 | import java.util.Iterator; 23 | 24 | /** 25 | * An iterator that transforms a backing iterator; for internal use. This avoids the object overhead 26 | * of constructing a {@link com.google.common.base.Function Function} for internal methods. 27 | * 28 | * @author Louis Wasserman 29 | */ 30 | @GwtCompatible 31 | abstract class TransformedIterator implements Iterator { 32 | final Iterator backingIterator; 33 | 34 | TransformedIterator(Iterator backingIterator) { 35 | this.backingIterator = checkNotNull(backingIterator); 36 | } 37 | 38 | abstract T transform(F from); 39 | 40 | @Override 41 | public final boolean hasNext() { 42 | return backingIterator.hasNext(); 43 | } 44 | 45 | @Override 46 | public final T next() { 47 | return transform(backingIterator.next()); 48 | } 49 | 50 | @Override 51 | public final void remove() { 52 | backingIterator.remove(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/TransformedListIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import com.google.common.base.Function; 21 | import java.util.ListIterator; 22 | 23 | /** 24 | * An iterator that transforms a backing list iterator; for internal use. This avoids the object 25 | * overhead of constructing a {@link Function} for internal methods. 26 | * 27 | * @author Louis Wasserman 28 | */ 29 | @GwtCompatible 30 | abstract class TransformedListIterator extends TransformedIterator 31 | implements ListIterator { 32 | TransformedListIterator(ListIterator backingIterator) { 33 | super(backingIterator); 34 | } 35 | 36 | private ListIterator backingIterator() { 37 | return Iterators.cast(backingIterator); 38 | } 39 | 40 | @Override 41 | public final boolean hasPrevious() { 42 | return backingIterator().hasPrevious(); 43 | } 44 | 45 | @Override 46 | public final T previous() { 47 | return transform(backingIterator().previous()); 48 | } 49 | 50 | @Override 51 | public final int nextIndex() { 52 | return backingIterator().nextIndex(); 53 | } 54 | 55 | @Override 56 | public final int previousIndex() { 57 | return backingIterator().previousIndex(); 58 | } 59 | 60 | @Override 61 | public void set(T element) { 62 | throw new UnsupportedOperationException(); 63 | } 64 | 65 | @Override 66 | public void add(T element) { 67 | throw new UnsupportedOperationException(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/UnmodifiableIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.Iterator; 21 | 22 | /** 23 | * An iterator that does not support {@link #remove}. 24 | * 25 | *

{@code UnmodifiableIterator} is used primarily in conjunction with implementations of {@link 26 | * ImmutableCollection}, such as {@link ImmutableList}. You can, however, convert an existing 27 | * iterator to an {@code UnmodifiableIterator} using {@link Iterators#unmodifiableIterator}. 28 | * 29 | * @author Jared Levy 30 | * @since 2.0 31 | */ 32 | @GwtCompatible 33 | public abstract class UnmodifiableIterator implements Iterator { 34 | /** Constructor for use by subclasses. */ 35 | protected UnmodifiableIterator() {} 36 | 37 | /** 38 | * Guaranteed to throw an exception and leave the underlying data unmodified. 39 | * 40 | * @throws UnsupportedOperationException always 41 | * @deprecated Unsupported operation. 42 | */ 43 | @Deprecated 44 | @Override 45 | public final void remove() { 46 | throw new UnsupportedOperationException(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/UnmodifiableListIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.util.ListIterator; 21 | 22 | /** 23 | * A list iterator that does not support {@link #remove}, {@link #add}, or {@link #set}. 24 | * 25 | * @since 7.0 26 | * @author Louis Wasserman 27 | */ 28 | @GwtCompatible 29 | public abstract class UnmodifiableListIterator extends UnmodifiableIterator 30 | implements ListIterator { 31 | /** Constructor for use by subclasses. */ 32 | protected UnmodifiableListIterator() {} 33 | 34 | /** 35 | * Guaranteed to throw an exception and leave the underlying data unmodified. 36 | * 37 | * @throws UnsupportedOperationException always 38 | * @deprecated Unsupported operation. 39 | */ 40 | @Deprecated 41 | @Override 42 | public final void add(E e) { 43 | throw new UnsupportedOperationException(); 44 | } 45 | 46 | /** 47 | * Guaranteed to throw an exception and leave the underlying data unmodified. 48 | * 49 | * @throws UnsupportedOperationException always 50 | * @deprecated Unsupported operation. 51 | */ 52 | @Deprecated 53 | @Override 54 | public final void set(E e) { 55 | throw new UnsupportedOperationException(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/collect/UsingToStringOrdering.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.collect; 18 | 19 | import com.google.common.annotations.GwtCompatible; 20 | import java.io.Serializable; 21 | 22 | /** An ordering that uses the natural order of the string representation of the values. */ 23 | @GwtCompatible(serializable = true) 24 | final class UsingToStringOrdering extends Ordering implements Serializable { 25 | static final UsingToStringOrdering INSTANCE = new UsingToStringOrdering(); 26 | 27 | @Override 28 | public int compare(Object left, Object right) { 29 | return left.toString().compareTo(right.toString()); 30 | } 31 | 32 | // preserve singleton-ness, so equals() and hashCode() work correctly 33 | private Object readResolve() { 34 | return INSTANCE; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return "Ordering.usingToString()"; 40 | } 41 | 42 | private UsingToStringOrdering() {} 43 | 44 | private static final long serialVersionUID = 0; 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/escape/Platform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.escape; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Methods factored out so that they can be emulated differently in GWT. 21 | * 22 | * @author Jesse Wilson 23 | */ 24 | @GwtCompatible(emulated = true) 25 | final class Platform { 26 | private Platform() {} 27 | 28 | /** Returns a thread-local 1024-char array. */ 29 | static char[] charBufferFromThreadLocal() { 30 | return DEST_TL.get(); 31 | } 32 | 33 | /** 34 | * A thread-local destination buffer to keep us from creating new buffers. The starting size is 35 | * 1024 characters. If we grow past this we don't put it back in the threadlocal, we just keep 36 | * going and grow as needed. 37 | */ 38 | private static final ThreadLocal DEST_TL = 39 | new ThreadLocal() { 40 | @Override 41 | protected char[] initialValue() { 42 | return new char[1024]; 43 | } 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/escape/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Interfaces, utilities, and simple implementations of escapers and encoders. The primary type is 17 | * {@link com.google.common.escape.Escaper}. 18 | * 19 | *

Additional escapers implementations are found in the applicable packages: {@link 20 | * com.google.common.html.HtmlEscapers} in {@code com.google.common.html}, {@link 21 | * com.google.common.xml.XmlEscapers} in {@code com.google.common.xml}, and {@link 22 | * com.google.common.net.UrlEscapers} in {@code com.google.common.net}. 23 | * 24 | *

This package is a part of the open-source Guava 25 | * library. 26 | */ 27 | @CheckReturnValue 28 | @ParametersAreNonnullByDefault 29 | package com.google.common.escape; 30 | 31 | import com.google.errorprone.annotations.CheckReturnValue; 32 | import javax.annotation.ParametersAreNonnullByDefault; 33 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/eventbus/AllowConcurrentEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.eventbus; 16 | 17 | import com.google.common.annotations.Beta; 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * Marks an event subscriber method as being thread-safe. This annotation indicates that EventBus 25 | * may invoke the event subscriber simultaneously from multiple threads. 26 | * 27 | *

This does not mark the method, and so should be used in combination with {@link Subscribe}. 28 | * 29 | * @author Cliff Biffle 30 | * @since 10.0 31 | */ 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Target(ElementType.METHOD) 34 | @Beta 35 | public @interface AllowConcurrentEvents {} 36 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/eventbus/Subscribe.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.eventbus; 16 | 17 | import com.google.common.annotations.Beta; 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Retention; 20 | import java.lang.annotation.RetentionPolicy; 21 | import java.lang.annotation.Target; 22 | 23 | /** 24 | * Marks a method as an event subscriber. 25 | * 26 | *

The type of event will be indicated by the method's first (and only) parameter. If this 27 | * annotation is applied to methods with zero parameters, or more than one parameter, the object 28 | * containing the method will not be able to register for event delivery from the {@link EventBus}. 29 | * 30 | *

Unless also annotated with @{@link AllowConcurrentEvents}, event subscriber methods will be 31 | * invoked serially by each event bus that they are registered with. 32 | * 33 | * @author Cliff Biffle 34 | * @since 10.0 35 | */ 36 | @Retention(RetentionPolicy.RUNTIME) 37 | @Target(ElementType.METHOD) 38 | @Beta 39 | public @interface Subscribe {} 40 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/eventbus/SubscriberExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.eventbus; 16 | 17 | /** 18 | * Handler for exceptions thrown by event subscribers. 19 | * 20 | * @since 16.0 21 | */ 22 | public interface SubscriberExceptionHandler { 23 | /** Handles exceptions thrown by subscribers. */ 24 | void handleException(Throwable exception, SubscriberExceptionContext context); 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/graph/AbstractGraph.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.graph; 18 | 19 | import com.google.common.annotations.Beta; 20 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 21 | 22 | /** 23 | * This class provides a skeletal implementation of {@link Graph}. It is recommended to extend this 24 | * class rather than implement {@link Graph} directly. 25 | * 26 | * @author James Sexton 27 | * @param Node parameter type 28 | * @since 20.0 29 | */ 30 | @Beta 31 | public abstract class AbstractGraph extends AbstractBaseGraph implements Graph { 32 | 33 | @Override 34 | public final boolean equals(@NullableDecl Object obj) { 35 | if (obj == this) { 36 | return true; 37 | } 38 | if (!(obj instanceof Graph)) { 39 | return false; 40 | } 41 | Graph other = (Graph) obj; 42 | 43 | return isDirected() == other.isDirected() 44 | && nodes().equals(other.nodes()) 45 | && edges().equals(other.edges()); 46 | } 47 | 48 | @Override 49 | public final int hashCode() { 50 | return edges().hashCode(); 51 | } 52 | 53 | /** Returns a string representation of this graph. */ 54 | @Override 55 | public String toString() { 56 | return "isDirected: " 57 | + isDirected() 58 | + ", allowsSelfLoops: " 59 | + allowsSelfLoops() 60 | + ", nodes: " 61 | + nodes() 62 | + ", edges: " 63 | + edges(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/graph/AbstractGraphBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.graph; 18 | 19 | import com.google.common.base.Optional; 20 | 21 | /** 22 | * A base class for builders that construct graphs with user-defined properties. 23 | * 24 | * @author James Sexton 25 | */ 26 | abstract class AbstractGraphBuilder { 27 | final boolean directed; 28 | boolean allowsSelfLoops = false; 29 | ElementOrder nodeOrder = ElementOrder.insertion(); 30 | Optional expectedNodeCount = Optional.absent(); 31 | 32 | /** 33 | * Creates a new instance with the specified edge directionality. 34 | * 35 | * @param directed if true, creates an instance for graphs whose edges are each directed; if 36 | * false, creates an instance for graphs whose edges are each undirected. 37 | */ 38 | AbstractGraphBuilder(boolean directed) { 39 | this.directed = directed; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/graph/ConfigurableMutableGraph.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.graph; 18 | 19 | import com.google.common.graph.GraphConstants.Presence; 20 | 21 | /** 22 | * Configurable implementation of {@link MutableGraph} that supports both directed and undirected 23 | * graphs. Instances of this class should be constructed with {@link GraphBuilder}. 24 | * 25 | *

Time complexities for mutation methods are all O(1) except for {@code removeNode(N node)}, 26 | * which is in O(d_node) where d_node is the degree of {@code node}. 27 | * 28 | * @author James Sexton 29 | * @param Node parameter type 30 | */ 31 | final class ConfigurableMutableGraph extends ForwardingGraph implements MutableGraph { 32 | private final MutableValueGraph backingValueGraph; 33 | 34 | /** Constructs a {@link MutableGraph} with the properties specified in {@code builder}. */ 35 | ConfigurableMutableGraph(AbstractGraphBuilder builder) { 36 | this.backingValueGraph = new ConfigurableMutableValueGraph<>(builder); 37 | } 38 | 39 | @Override 40 | protected BaseGraph delegate() { 41 | return backingValueGraph; 42 | } 43 | 44 | @Override 45 | public boolean addNode(N node) { 46 | return backingValueGraph.addNode(node); 47 | } 48 | 49 | @Override 50 | public boolean putEdge(N nodeU, N nodeV) { 51 | return backingValueGraph.putEdgeValue(nodeU, nodeV, Presence.EDGE_EXISTS) == null; 52 | } 53 | 54 | @Override 55 | public boolean removeNode(N node) { 56 | return backingValueGraph.removeNode(node); 57 | } 58 | 59 | @Override 60 | public boolean removeEdge(N nodeU, N nodeV) { 61 | return backingValueGraph.removeEdge(nodeU, nodeV) != null; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/graph/UndirectedNetworkConnections.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.graph; 18 | 19 | import static com.google.common.graph.GraphConstants.EXPECTED_DEGREE; 20 | 21 | import com.google.common.collect.BiMap; 22 | import com.google.common.collect.HashBiMap; 23 | import com.google.common.collect.ImmutableBiMap; 24 | import java.util.Collections; 25 | import java.util.Map; 26 | import java.util.Set; 27 | 28 | /** 29 | * An implementation of {@link NetworkConnections} for undirected networks. 30 | * 31 | * @author James Sexton 32 | * @param Node parameter type 33 | * @param Edge parameter type 34 | */ 35 | final class UndirectedNetworkConnections extends AbstractUndirectedNetworkConnections { 36 | 37 | protected UndirectedNetworkConnections(Map incidentEdgeMap) { 38 | super(incidentEdgeMap); 39 | } 40 | 41 | static UndirectedNetworkConnections of() { 42 | return new UndirectedNetworkConnections<>(HashBiMap.create(EXPECTED_DEGREE)); 43 | } 44 | 45 | static UndirectedNetworkConnections ofImmutable(Map incidentEdges) { 46 | return new UndirectedNetworkConnections<>(ImmutableBiMap.copyOf(incidentEdges)); 47 | } 48 | 49 | @Override 50 | public Set adjacentNodes() { 51 | return Collections.unmodifiableSet(((BiMap) incidentEdgeMap).values()); 52 | } 53 | 54 | @Override 55 | public Set edgesConnecting(N node) { 56 | return new EdgesConnecting(((BiMap) incidentEdgeMap).inverse(), node); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/graph/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * An API for representing graph (node and edge) data. It is analogous to the Java Collections 19 | * Framework APIs for lists, maps, sets, etc. 20 | * 21 | *

This package is a part of the open-source Guava 22 | * library. 23 | */ 24 | @CheckReturnValue 25 | @ParametersAreNonnullByDefault 26 | package com.google.common.graph; 27 | 28 | import com.google.errorprone.annotations.CheckReturnValue; 29 | import javax.annotation.ParametersAreNonnullByDefault; 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/hash/Funnel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.hash; 16 | 17 | import com.google.common.annotations.Beta; 18 | import java.io.Serializable; 19 | 20 | /** 21 | * An object which can send data from an object of type {@code T} into a {@code PrimitiveSink}. 22 | * Implementations for common types can be found in {@link Funnels}. 23 | * 24 | *

Note that serialization of {@linkplain BloomFilter bloom filters} requires the proper 25 | * serialization of funnels. When possible, it is recommended that funnels be implemented as a 26 | * single-element enum to maintain serialization guarantees. See Effective Java (2nd Edition), Item 27 | * 3: "Enforce the singleton property with a private constructor or an enum type". For example: 28 | * 29 | *

{@code
30 |  * public enum PersonFunnel implements Funnel {
31 |  *   INSTANCE;
32 |  *   public void funnel(Person person, PrimitiveSink into) {
33 |  *     into.putUnencodedChars(person.getFirstName())
34 |  *         .putUnencodedChars(person.getLastName())
35 |  *         .putInt(person.getAge());
36 |  *   }
37 |  * }
38 |  * }
39 | * 40 | * @author Dimitris Andreou 41 | * @since 11.0 42 | */ 43 | @Beta 44 | public interface Funnel extends Serializable { 45 | 46 | /** 47 | * Sends a stream of data from the {@code from} object into the sink {@code into}. There is no 48 | * requirement that this data be complete enough to fully reconstitute the object later. 49 | * 50 | * @since 12.0 (in Guava 11.0, {@code PrimitiveSink} was named {@code Sink}) 51 | */ 52 | void funnel(T from, PrimitiveSink into); 53 | } 54 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/hash/LongAddable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.hash; 16 | 17 | /** 18 | * Abstract interface for objects that can concurrently add longs. 19 | * 20 | * @author Louis Wasserman 21 | */ 22 | interface LongAddable { 23 | void increment(); 24 | 25 | void add(long x); 26 | 27 | long sum(); 28 | } 29 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/hash/LongAddables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.hash; 16 | 17 | import com.google.common.base.Supplier; 18 | import java.util.concurrent.atomic.AtomicLong; 19 | 20 | /** 21 | * Source of {@link LongAddable} objects that deals with GWT, Unsafe, and all that. 22 | * 23 | * @author Louis Wasserman 24 | */ 25 | final class LongAddables { 26 | private static final Supplier SUPPLIER; 27 | 28 | static { 29 | Supplier supplier; 30 | try { 31 | new LongAdder(); // trigger static initialization of the LongAdder class, which may fail 32 | supplier = 33 | new Supplier() { 34 | @Override 35 | public LongAddable get() { 36 | return new LongAdder(); 37 | } 38 | }; 39 | } catch (Throwable t) { // we really want to catch *everything* 40 | supplier = 41 | new Supplier() { 42 | @Override 43 | public LongAddable get() { 44 | return new PureJavaLongAddable(); 45 | } 46 | }; 47 | } 48 | SUPPLIER = supplier; 49 | } 50 | 51 | public static LongAddable create() { 52 | return SUPPLIER.get(); 53 | } 54 | 55 | private static final class PureJavaLongAddable extends AtomicLong implements LongAddable { 56 | @Override 57 | public void increment() { 58 | getAndIncrement(); 59 | } 60 | 61 | @Override 62 | public void add(long x) { 63 | getAndAdd(x); 64 | } 65 | 66 | @Override 67 | public long sum() { 68 | return get(); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/hash/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | // TODO(user): when things stabilize, flesh this out 16 | /** 17 | * Hash functions and related structures. 18 | * 19 | *

See the Guava User Guide article on hashing. 21 | */ 22 | @CheckReturnValue 23 | @ParametersAreNonnullByDefault 24 | package com.google.common.hash; 25 | 26 | import com.google.errorprone.annotations.CheckReturnValue; 27 | import javax.annotation.ParametersAreNonnullByDefault; 28 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/html/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Escapers 17 | * for 18 | * HTML. 19 | * 20 | *

This package is a part of the open-source Guava 21 | * library. 22 | */ 23 | @CheckReturnValue 24 | @ParametersAreNonnullByDefault 25 | package com.google.common.html; 26 | 27 | import com.google.errorprone.annotations.CheckReturnValue; 28 | import javax.annotation.ParametersAreNonnullByDefault; 29 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/ByteArrayDataOutput.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.io; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | import java.io.DataOutput; 19 | import java.io.IOException; 20 | 21 | /** 22 | * An extension of {@code DataOutput} for writing to in-memory byte arrays; its methods offer 23 | * identical functionality but do not throw {@link IOException}. 24 | * 25 | * @author Jayaprabhakar Kadarkarai 26 | * @since 1.0 27 | */ 28 | @GwtIncompatible 29 | public interface ByteArrayDataOutput extends DataOutput { 30 | @Override 31 | void write(int b); 32 | 33 | @Override 34 | void write(byte b[]); 35 | 36 | @Override 37 | void write(byte b[], int off, int len); 38 | 39 | @Override 40 | void writeBoolean(boolean v); 41 | 42 | @Override 43 | void writeByte(int v); 44 | 45 | @Override 46 | void writeShort(int v); 47 | 48 | @Override 49 | void writeChar(int v); 50 | 51 | @Override 52 | void writeInt(int v); 53 | 54 | @Override 55 | void writeLong(long v); 56 | 57 | @Override 58 | void writeFloat(float v); 59 | 60 | @Override 61 | void writeDouble(double v); 62 | 63 | @Override 64 | void writeChars(String s); 65 | 66 | @Override 67 | void writeUTF(String s); 68 | 69 | /** 70 | * @deprecated This method is dangerous as it discards the high byte of every character. For 71 | * UTF-8, use {@code write(s.getBytes(StandardCharsets.UTF_8))}. 72 | */ 73 | @Deprecated 74 | @Override 75 | void writeBytes(String s); 76 | 77 | /** Returns the contents that have been written to this instance, as a byte array. */ 78 | byte[] toByteArray(); 79 | } 80 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/ByteProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.io; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtIncompatible; 19 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 20 | import java.io.IOException; 21 | 22 | /** 23 | * A callback interface to process bytes from a stream. 24 | * 25 | *

{@link #processBytes} will be called for each chunk of data that is read, and should return 26 | * {@code false} when you want to stop processing. 27 | * 28 | * @author Chris Nokleberg 29 | * @since 1.0 30 | */ 31 | @Beta 32 | @GwtIncompatible 33 | public interface ByteProcessor { 34 | /** 35 | * This method will be called for each chunk of bytes in an input stream. The implementation 36 | * should process the bytes from {@code buf[off]} through {@code buf[off + len - 1]} (inclusive). 37 | * 38 | * @param buf the byte array containing the data to process 39 | * @param off the initial offset into the array 40 | * @param len the length of data to be processed 41 | * @return true to continue processing, false to stop 42 | */ 43 | @CanIgnoreReturnValue // some uses know that their processor never returns false 44 | boolean processBytes(byte[] buf, int off, int len) throws IOException; 45 | 46 | /** Return the result of processing all the bytes. */ 47 | T getResult(); 48 | } 49 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/CountingOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.io; 16 | 17 | import static com.google.common.base.Preconditions.checkNotNull; 18 | 19 | import com.google.common.annotations.Beta; 20 | import com.google.common.annotations.GwtIncompatible; 21 | import java.io.FilterOutputStream; 22 | import java.io.IOException; 23 | import java.io.OutputStream; 24 | 25 | /** 26 | * An OutputStream that counts the number of bytes written. 27 | * 28 | * @author Chris Nokleberg 29 | * @since 1.0 30 | */ 31 | @Beta 32 | @GwtIncompatible 33 | public final class CountingOutputStream extends FilterOutputStream { 34 | 35 | private long count; 36 | 37 | /** 38 | * Wraps another output stream, counting the number of bytes written. 39 | * 40 | * @param out the output stream to be wrapped 41 | */ 42 | public CountingOutputStream(OutputStream out) { 43 | super(checkNotNull(out)); 44 | } 45 | 46 | /** Returns the number of bytes written. */ 47 | public long getCount() { 48 | return count; 49 | } 50 | 51 | @Override 52 | public void write(byte[] b, int off, int len) throws IOException { 53 | out.write(b, off, len); 54 | count += len; 55 | } 56 | 57 | @Override 58 | public void write(int b) throws IOException { 59 | out.write(b); 60 | count++; 61 | } 62 | 63 | // Overriding close() because FilterOutputStream's close() method pre-JDK8 has bad behavior: 64 | // it silently ignores any exception thrown by flush(). Instead, just close the delegate stream. 65 | // It should flush itself if necessary. 66 | @Override 67 | public void close() throws IOException { 68 | out.close(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/FileWriteMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.io; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | 19 | /** 20 | * Modes for opening a file for writing. The default when mode when none is specified is to truncate 21 | * the file before writing. 22 | * 23 | * @author Colin Decker 24 | */ 25 | @GwtIncompatible 26 | public enum FileWriteMode { 27 | /** Specifies that writes to the opened file should append to the end of the file. */ 28 | APPEND 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/InsecureRecursiveDeleteException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.io; 18 | 19 | import com.google.common.annotations.Beta; 20 | import com.google.common.annotations.GwtIncompatible; 21 | import com.google.j2objc.annotations.J2ObjCIncompatible; 22 | import java.nio.file.FileSystemException; 23 | import java.nio.file.SecureDirectoryStream; 24 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 25 | 26 | /** 27 | * Exception indicating that a recursive delete can't be performed because the file system does not 28 | * have the support necessary to guarantee that it is not vulnerable to race conditions that would 29 | * allow it to delete files and directories outside of the directory being deleted (i.e., {@link 30 | * SecureDirectoryStream} is not supported). 31 | * 32 | *

{@link RecursiveDeleteOption#ALLOW_INSECURE} can be used to force the recursive delete method 33 | * to proceed anyway. 34 | * 35 | * @since 21.0 36 | * @author Colin Decker 37 | */ 38 | @Beta 39 | @GwtIncompatible 40 | @J2ObjCIncompatible // java.nio.file 41 | public final class InsecureRecursiveDeleteException extends FileSystemException { 42 | 43 | public InsecureRecursiveDeleteException(@NullableDecl String file) { 44 | super(file, null, "unable to guarantee security of recursive delete"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/LineProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.io; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtIncompatible; 19 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 20 | import java.io.IOException; 21 | 22 | /** 23 | * A callback to be used with the streaming {@code readLines} methods. 24 | * 25 | *

{@link #processLine} will be called for each line that is read, and should return {@code 26 | * false} when you want to stop processing. 27 | * 28 | * @author Miles Barr 29 | * @since 1.0 30 | */ 31 | @Beta 32 | @GwtIncompatible 33 | public interface LineProcessor { 34 | 35 | /** 36 | * This method will be called once for each line. 37 | * 38 | * @param line the line read from the input, without delimiter 39 | * @return true to continue processing, false to stop 40 | */ 41 | @CanIgnoreReturnValue // some uses know that their processor never returns false 42 | boolean processLine(String line) throws IOException; 43 | 44 | /** Return the result of processing all the lines. */ 45 | T getResult(); 46 | } 47 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/PatternFilenameFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.io; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtIncompatible; 19 | import com.google.common.base.Preconditions; 20 | import java.io.File; 21 | import java.io.FilenameFilter; 22 | import java.util.regex.Pattern; 23 | import java.util.regex.PatternSyntaxException; 24 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 25 | 26 | /** 27 | * File name filter that only accepts files matching a regular expression. This class is thread-safe 28 | * and immutable. 29 | * 30 | * @author Apple Chow 31 | * @since 1.0 32 | */ 33 | @Beta 34 | @GwtIncompatible 35 | public final class PatternFilenameFilter implements FilenameFilter { 36 | 37 | private final Pattern pattern; 38 | 39 | /** 40 | * Constructs a pattern file name filter object. 41 | * 42 | * @param patternStr the pattern string on which to filter file names 43 | * @throws PatternSyntaxException if pattern compilation fails (runtime) 44 | */ 45 | public PatternFilenameFilter(String patternStr) { 46 | this(Pattern.compile(patternStr)); 47 | } 48 | 49 | /** 50 | * Constructs a pattern file name filter object. 51 | * 52 | * @param pattern the pattern on which to filter file names 53 | */ 54 | public PatternFilenameFilter(Pattern pattern) { 55 | this.pattern = Preconditions.checkNotNull(pattern); 56 | } 57 | 58 | @Override 59 | public boolean accept(@NullableDecl File dir, String fileName) { 60 | return pattern.matcher(fileName).matches(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/RecursiveDeleteOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.google.common.io; 18 | 19 | import com.google.common.annotations.Beta; 20 | import com.google.common.annotations.GwtIncompatible; 21 | import com.google.j2objc.annotations.J2ObjCIncompatible; 22 | import java.nio.file.SecureDirectoryStream; 23 | 24 | /** 25 | * Options for use with recursive delete methods ({@link MoreFiles#deleteRecursively} and {@link 26 | * MoreFiles#deleteDirectoryContents}). 27 | * 28 | * @since 21.0 29 | * @author Colin Decker 30 | */ 31 | @Beta 32 | @GwtIncompatible 33 | @J2ObjCIncompatible // java.nio.file 34 | public enum RecursiveDeleteOption { 35 | /** 36 | * Specifies that the recursive delete should not throw an exception when it can't be guaranteed 37 | * that it can be done securely, without vulnerability to race conditions (i.e. when the file 38 | * system does not support {@link SecureDirectoryStream}). 39 | * 40 | *

Warning: On a file system that supports symbolic links, it is possible for an 41 | * insecure recursive delete to delete files and directories that are outside the directory 42 | * being deleted. This can happen if, after checking that a file is a directory (and not a 43 | * symbolic link), that directory is deleted and replaced by a symbolic link to an outside 44 | * directory before the call that opens the directory to read its entries. File systems that 45 | * support {@code SecureDirectoryStream} do not have this vulnerability. 46 | */ 47 | ALLOW_INSECURE 48 | } 49 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/io/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * This package contains utility methods and classes for working with Java I/O; for example input 17 | * streams, output streams, readers, writers, and files. 18 | * 19 | *

At the core of this package are the Source/Sink types: {@link com.google.common.io.ByteSource 20 | * ByteSource}, {@link com.google.common.io.CharSource CharSource}, {@link 21 | * com.google.common.io.ByteSink ByteSink} and {@link com.google.common.io.CharSink CharSink}. They 22 | * are factories for I/O streams that provide many convenience methods that handle both opening and 23 | * closing streams for you. 24 | * 25 | *

This package is a part of the open-source Guava 26 | * library. For more information on Sources and Sinks as well as other features of this package, see 27 | * I/O Explained on the Guava wiki. 28 | * 29 | * @author Chris Nokleberg 30 | */ 31 | @CheckReturnValue 32 | @ParametersAreNonnullByDefault 33 | package com.google.common.io; 34 | 35 | import com.google.errorprone.annotations.CheckReturnValue; 36 | import javax.annotation.ParametersAreNonnullByDefault; 37 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/math/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Arithmetic functions operating on primitive values and {@link java.math.BigInteger} instances. 17 | * 18 | *

This package is a part of the open-source Guava 19 | * library. 20 | * 21 | *

See the Guava User Guide article on math utilities. 23 | */ 24 | @ParametersAreNonnullByDefault 25 | @CheckReturnValue 26 | package com.google.common.math; 27 | 28 | import com.google.errorprone.annotations.CheckReturnValue; 29 | import javax.annotation.ParametersAreNonnullByDefault; 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/net/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * This package contains utility methods and classes for working with net addresses (numeric IP and 17 | * domain names). 18 | * 19 | *

This package is a part of the open-source Guava 20 | * library. 21 | * 22 | * @author Craig Berry 23 | */ 24 | @ParametersAreNonnullByDefault 25 | package com.google.common.net; 26 | 27 | import javax.annotation.ParametersAreNonnullByDefault; 28 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/primitives/ParseRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.primitives; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** A string to be parsed as a number and the radix to interpret it in. */ 20 | @GwtCompatible 21 | final class ParseRequest { 22 | final String rawValue; 23 | final int radix; 24 | 25 | private ParseRequest(String rawValue, int radix) { 26 | this.rawValue = rawValue; 27 | this.radix = radix; 28 | } 29 | 30 | static ParseRequest fromString(String stringValue) { 31 | if (stringValue.length() == 0) { 32 | throw new NumberFormatException("empty string"); 33 | } 34 | 35 | // Handle radix specifier if present 36 | String rawValue; 37 | int radix; 38 | char firstChar = stringValue.charAt(0); 39 | if (stringValue.startsWith("0x") || stringValue.startsWith("0X")) { 40 | rawValue = stringValue.substring(2); 41 | radix = 16; 42 | } else if (firstChar == '#') { 43 | rawValue = stringValue.substring(1); 44 | radix = 16; 45 | } else if (firstChar == '0' && stringValue.length() > 1) { 46 | rawValue = stringValue.substring(1); 47 | radix = 8; 48 | } else { 49 | rawValue = stringValue; 50 | radix = 10; 51 | } 52 | 53 | return new ParseRequest(rawValue, radix); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/reflect/TypeCapture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.reflect; 16 | 17 | import static com.google.common.base.Preconditions.checkArgument; 18 | 19 | import java.lang.reflect.ParameterizedType; 20 | import java.lang.reflect.Type; 21 | 22 | /** 23 | * Captures the actual type of {@code T}. 24 | * 25 | * @author Ben Yu 26 | */ 27 | abstract class TypeCapture { 28 | 29 | /** Returns the captured type. */ 30 | final Type capture() { 31 | Type superclass = getClass().getGenericSuperclass(); 32 | checkArgument(superclass instanceof ParameterizedType, "%s isn't parameterized", superclass); 33 | return ((ParameterizedType) superclass).getActualTypeArguments()[0]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/reflect/TypeParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.reflect; 16 | 17 | import static com.google.common.base.Preconditions.checkArgument; 18 | 19 | import com.google.common.annotations.Beta; 20 | import java.lang.reflect.Type; 21 | import java.lang.reflect.TypeVariable; 22 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 23 | 24 | /** 25 | * Captures a free type variable that can be used in {@link TypeToken#where}. For example: 26 | * 27 | *

{@code
28 |  * static  TypeToken> listOf(Class elementType) {
29 |  *   return new TypeToken>() {}
30 |  *       .where(new TypeParameter() {}, elementType);
31 |  * }
32 |  * }
33 | * 34 | * @author Ben Yu 35 | * @since 12.0 36 | */ 37 | @Beta 38 | public abstract class TypeParameter extends TypeCapture { 39 | 40 | final TypeVariable typeVariable; 41 | 42 | protected TypeParameter() { 43 | Type type = capture(); 44 | checkArgument(type instanceof TypeVariable, "%s should be a type variable.", type); 45 | this.typeVariable = (TypeVariable) type; 46 | } 47 | 48 | @Override 49 | public final int hashCode() { 50 | return typeVariable.hashCode(); 51 | } 52 | 53 | @Override 54 | public final boolean equals(@NullableDecl Object o) { 55 | if (o instanceof TypeParameter) { 56 | TypeParameter that = (TypeParameter) o; 57 | return typeVariable.equals(that.typeVariable); 58 | } 59 | return false; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return typeVariable.toString(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/reflect/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * This package contains utilities to work with Java reflection. It is a part of the open-source Guava library. 18 | */ 19 | @CheckReturnValue 20 | @ParametersAreNonnullByDefault 21 | package com.google.common.reflect; 22 | 23 | import com.google.errorprone.annotations.CheckReturnValue; 24 | import javax.annotation.ParametersAreNonnullByDefault; 25 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/AsyncCallable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtCompatible; 19 | import java.util.concurrent.Future; 20 | 21 | /** 22 | * Computes a value, possibly asynchronously. For an example usage and more information, see {@link 23 | * Futures.FutureCombiner#callAsync(AsyncCallable, java.util.concurrent.Executor)}. 24 | * 25 | *

Much like {@link java.util.concurrent.Callable}, but returning a {@link ListenableFuture} 26 | * result. 27 | * 28 | * @since 20.0 29 | */ 30 | @Beta 31 | @FunctionalInterface 32 | @GwtCompatible 33 | public interface AsyncCallable { 34 | /** 35 | * Computes a result {@code Future}. The output {@code Future} need not be {@linkplain 36 | * Future#isDone done}, making {@code AsyncCallable} suitable for asynchronous derivations. 37 | * 38 | *

Throwing an exception from this method is equivalent to returning a failing {@link 39 | * ListenableFuture}. 40 | */ 41 | ListenableFuture call() throws Exception; 42 | } 43 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/AsyncFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import java.util.concurrent.Future; 19 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 20 | 21 | /** 22 | * Transforms a value, possibly asynchronously. For an example usage and more information, see 23 | * {@link Futures#transformAsync(ListenableFuture, AsyncFunction, Executor)}. 24 | * 25 | * @author Chris Povirk 26 | * @since 11.0 27 | */ 28 | @GwtCompatible 29 | @FunctionalInterface 30 | public interface AsyncFunction { 31 | /** 32 | * Returns an output {@code Future} to use in place of the given {@code input}. The output {@code 33 | * Future} need not be {@linkplain Future#isDone done}, making {@code AsyncFunction} suitable for 34 | * asynchronous derivations. 35 | * 36 | *

Throwing an exception from this method is equivalent to returning a failing {@code Future}. 37 | */ 38 | ListenableFuture apply(@NullableDecl I input) throws Exception; 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/ExecutionError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 19 | 20 | /** 21 | * {@link Error} variant of {@link java.util.concurrent.ExecutionException}. As with {@code 22 | * ExecutionException}, the error's {@linkplain #getCause() cause} comes from a failed task, 23 | * possibly run in another thread. That cause should itself be an {@code Error}; if not, use {@code 24 | * ExecutionException} or {@link UncheckedExecutionException}. This allows the client code to 25 | * continue to distinguish between exceptions and errors, even when they come from other threads. 26 | * 27 | * @author Chris Povirk 28 | * @since 10.0 29 | */ 30 | @GwtCompatible 31 | public class ExecutionError extends Error { 32 | /** Creates a new instance with {@code null} as its detail message. */ 33 | protected ExecutionError() {} 34 | 35 | /** Creates a new instance with the given detail message. */ 36 | protected ExecutionError(@NullableDecl String message) { 37 | super(message); 38 | } 39 | 40 | /** Creates a new instance with the given detail message and cause. */ 41 | public ExecutionError(@NullableDecl String message, @NullableDecl Error cause) { 42 | super(message, cause); 43 | } 44 | 45 | /** Creates a new instance with the given cause. */ 46 | public ExecutionError(@NullableDecl Error cause) { 47 | super(cause); 48 | } 49 | 50 | private static final long serialVersionUID = 0; 51 | } 52 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/ForwardingCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import java.util.Date; 18 | import java.util.concurrent.TimeUnit; 19 | import java.util.concurrent.locks.Condition; 20 | 21 | /** Forwarding wrapper around a {@code Condition}. */ 22 | abstract class ForwardingCondition implements Condition { 23 | abstract Condition delegate(); 24 | 25 | @Override 26 | public void await() throws InterruptedException { 27 | delegate().await(); 28 | } 29 | 30 | @Override 31 | public void awaitUninterruptibly() { 32 | delegate().awaitUninterruptibly(); 33 | } 34 | 35 | @Override 36 | public long awaitNanos(long nanosTimeout) throws InterruptedException { 37 | return delegate().awaitNanos(nanosTimeout); 38 | } 39 | 40 | @Override 41 | public boolean await(long time, TimeUnit unit) throws InterruptedException { 42 | return delegate().await(time, unit); 43 | } 44 | 45 | @Override 46 | public boolean awaitUntil(Date deadline) throws InterruptedException { 47 | return delegate().awaitUntil(deadline); 48 | } 49 | 50 | @Override 51 | public void signal() { 52 | delegate().signal(); 53 | } 54 | 55 | @Override 56 | public void signalAll() { 57 | delegate().signalAll(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/ForwardingListeningExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | import com.google.errorprone.annotations.CanIgnoreReturnValue; 19 | import java.util.concurrent.Callable; 20 | 21 | /** 22 | * A listening executor service which forwards all its method calls to another listening executor 23 | * service. Subclasses should override one or more methods to modify the behavior of the backing 24 | * executor service as desired per the decorator pattern. 26 | * 27 | * @author Isaac Shum 28 | * @since 10.0 29 | */ 30 | @CanIgnoreReturnValue // TODO(cpovirk): Consider being more strict. 31 | @GwtIncompatible 32 | public abstract class ForwardingListeningExecutorService extends ForwardingExecutorService 33 | implements ListeningExecutorService { 34 | /** Constructor for use by subclasses. */ 35 | protected ForwardingListeningExecutorService() {} 36 | 37 | @Override 38 | protected abstract ListeningExecutorService delegate(); 39 | 40 | @Override 41 | public ListenableFuture submit(Callable task) { 42 | return delegate().submit(task); 43 | } 44 | 45 | @Override 46 | public ListenableFuture submit(Runnable task) { 47 | return delegate().submit(task); 48 | } 49 | 50 | @Override 51 | public ListenableFuture submit(Runnable task, T result) { 52 | return delegate().submit(task, result); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/ForwardingLock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import java.util.concurrent.TimeUnit; 18 | import java.util.concurrent.locks.Condition; 19 | import java.util.concurrent.locks.Lock; 20 | 21 | /** Forwarding wrapper around a {@code Lock}. */ 22 | abstract class ForwardingLock implements Lock { 23 | abstract Lock delegate(); 24 | 25 | @Override 26 | public void lock() { 27 | delegate().lock(); 28 | } 29 | 30 | @Override 31 | public void lockInterruptibly() throws InterruptedException { 32 | delegate().lockInterruptibly(); 33 | } 34 | 35 | @Override 36 | public boolean tryLock() { 37 | return delegate().tryLock(); 38 | } 39 | 40 | @Override 41 | public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { 42 | return delegate().tryLock(time, unit); 43 | } 44 | 45 | @Override 46 | public void unlock() { 47 | delegate().unlock(); 48 | } 49 | 50 | @Override 51 | public Condition newCondition() { 52 | return delegate().newCondition(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/FutureCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import java.util.concurrent.ExecutionException; 19 | import java.util.concurrent.Future; 20 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 21 | 22 | /** 23 | * A callback for accepting the results of a {@link java.util.concurrent.Future} computation 24 | * asynchronously. 25 | * 26 | *

To attach to a {@link ListenableFuture} use {@link Futures#addCallback}. 27 | * 28 | * @author Anthony Zana 29 | * @since 10.0 30 | */ 31 | @GwtCompatible 32 | public interface FutureCallback { 33 | /** Invoked with the result of the {@code Future} computation when it is successful. */ 34 | void onSuccess(@NullableDecl V result); 35 | 36 | /** 37 | * Invoked when a {@code Future} computation fails or is canceled. 38 | * 39 | *

If the future's {@link Future#get() get} method throws an {@link ExecutionException}, then 40 | * the cause is passed to this method. Any other thrown object is passed unaltered. 41 | */ 42 | void onFailure(Throwable t); 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/GwtFluentFutureCatchingSpecialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Hidden superclass of {@link FluentFuture} that provides us a place to declare special GWT 21 | * versions of the {@link FluentFuture#catching(Class, com.google.common.base.Function) 22 | * FluentFuture.catching} family of methods. Those versions have slightly different signatures. 23 | */ 24 | @GwtCompatible(emulated = true) 25 | abstract class GwtFluentFutureCatchingSpecialization implements ListenableFuture { 26 | /* 27 | * This server copy of the class is empty. The corresponding GWT copy contains alternative 28 | * versions of catching() and catchingAsync() with slightly different signatures from the ones 29 | * found in FluentFuture.java. 30 | */ 31 | } 32 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/GwtFuturesCatchingSpecialization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | 19 | /** 20 | * Hidden superclass of {@link Futures} that provides us a place to declare special GWT versions of 21 | * the {@link Futures#catching(ListenableFuture, Class, com.google.common.base.Function, 22 | * java.util.concurrent.Executor) Futures.catching} family of methods. Those versions have slightly 23 | * different signatures. 24 | */ 25 | @GwtCompatible(emulated = true) 26 | abstract class GwtFuturesCatchingSpecialization { 27 | /* 28 | * This server copy of the class is empty. The corresponding GWT copy contains alternative 29 | * versions of catching() and catchingAsync() with slightly different signatures from the ones 30 | * found in Futures.java. 31 | */ 32 | } 33 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/ListenableScheduledFuture.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtCompatible; 19 | import java.util.concurrent.ScheduledFuture; 20 | 21 | /** 22 | * Helper interface to implement both {@link ListenableFuture} and {@link ScheduledFuture}. 23 | * 24 | * @author Anthony Zana 25 | * @since 15.0 26 | */ 27 | @Beta 28 | @GwtCompatible 29 | public interface ListenableScheduledFuture extends ScheduledFuture, ListenableFuture {} 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/ListeningScheduledExecutorService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtIncompatible; 19 | import java.util.concurrent.Callable; 20 | import java.util.concurrent.ScheduledExecutorService; 21 | import java.util.concurrent.TimeUnit; 22 | 23 | /** 24 | * A {@link ScheduledExecutorService} that returns {@link ListenableFuture} instances from its 25 | * {@code ExecutorService} methods. To create an instance from an existing {@link 26 | * ScheduledExecutorService}, call {@link 27 | * MoreExecutors#listeningDecorator(ScheduledExecutorService)}. 28 | * 29 | * @author Chris Povirk 30 | * @since 10.0 31 | */ 32 | @Beta 33 | @GwtIncompatible 34 | public interface ListeningScheduledExecutorService 35 | extends ScheduledExecutorService, ListeningExecutorService { 36 | 37 | /** @since 15.0 (previously returned ScheduledFuture) */ 38 | @Override 39 | ListenableScheduledFuture schedule(Runnable command, long delay, TimeUnit unit); 40 | 41 | /** @since 15.0 (previously returned ScheduledFuture) */ 42 | @Override 43 | ListenableScheduledFuture schedule(Callable callable, long delay, TimeUnit unit); 44 | 45 | /** @since 15.0 (previously returned ScheduledFuture) */ 46 | @Override 47 | ListenableScheduledFuture scheduleAtFixedRate( 48 | Runnable command, long initialDelay, long period, TimeUnit unit); 49 | 50 | /** @since 15.0 (previously returned ScheduledFuture) */ 51 | @Override 52 | ListenableScheduledFuture scheduleWithFixedDelay( 53 | Runnable command, long initialDelay, long delay, TimeUnit unit); 54 | } 55 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/Partially.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import java.lang.annotation.Documented; 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Outer class that exists solely to let us write {@code Partially.GwtIncompatible} instead of plain 26 | * {@code GwtIncompatible}. This is more accurate for {@link Futures#catching}, which is available 27 | * under GWT but with a slightly different signature. 28 | * 29 | *

We can't use {@code PartiallyGwtIncompatible} because then the GWT compiler wouldn't recognize 30 | * it as a {@code GwtIncompatible} annotation. And for {@code Futures.catching}, we need the GWT 31 | * compiler to autostrip the normal server method in order to expose the special, inherited GWT 32 | * version. 33 | */ 34 | @GwtCompatible 35 | final class Partially { 36 | /** 37 | * The presence of this annotation on an API indicates that the method may be used with the 38 | * Google Web Toolkit (GWT) but that it has some 39 | * restrictions. 40 | */ 41 | @Retention(RetentionPolicy.CLASS) 42 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) 43 | @Documented 44 | @interface GwtIncompatible { 45 | String value(); 46 | } 47 | 48 | private Partially() {} 49 | } 50 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/Platform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 19 | 20 | /** Methods factored out so that they can be emulated differently in GWT. */ 21 | @GwtCompatible(emulated = true) 22 | final class Platform { 23 | static boolean isInstanceOfThrowableClass( 24 | @NullableDecl Throwable t, Class expectedClass) { 25 | return expectedClass.isInstance(t); 26 | } 27 | 28 | private Platform() {} 29 | } 30 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/Runnables.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.Beta; 18 | import com.google.common.annotations.GwtCompatible; 19 | 20 | /** 21 | * Static utility methods pertaining to the {@link Runnable} interface. 22 | * 23 | * @since 16.0 24 | */ 25 | @Beta 26 | @GwtCompatible 27 | public final class Runnables { 28 | 29 | private static final Runnable EMPTY_RUNNABLE = 30 | new Runnable() { 31 | @Override 32 | public void run() {} 33 | }; 34 | 35 | /** Returns a {@link Runnable} instance that does nothing when run. */ 36 | public static Runnable doNothing() { 37 | return EMPTY_RUNNABLE; 38 | } 39 | 40 | private Runnables() {} 41 | } 42 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/UncheckedExecutionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtCompatible; 18 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 19 | 20 | /** 21 | * Unchecked variant of {@link java.util.concurrent.ExecutionException}. As with {@code 22 | * ExecutionException}, the exception's {@linkplain #getCause() cause} comes from a failed task, 23 | * possibly run in another thread. 24 | * 25 | *

{@code UncheckedExecutionException} is intended as an alternative to {@code 26 | * ExecutionException} when the exception thrown by a task is an unchecked exception. However, it 27 | * may also wrap a checked exception in some cases. 28 | * 29 | *

When wrapping an {@code Error} from another thread, prefer {@link ExecutionError}. When 30 | * wrapping a checked exception, prefer {@code ExecutionException}. 31 | * 32 | * @author Charles Fry 33 | * @since 10.0 34 | */ 35 | @GwtCompatible 36 | public class UncheckedExecutionException extends RuntimeException { 37 | /** Creates a new instance with {@code null} as its detail message. */ 38 | protected UncheckedExecutionException() {} 39 | 40 | /** Creates a new instance with the given detail message. */ 41 | protected UncheckedExecutionException(@NullableDecl String message) { 42 | super(message); 43 | } 44 | 45 | /** Creates a new instance with the given detail message and cause. */ 46 | public UncheckedExecutionException(@NullableDecl String message, @NullableDecl Throwable cause) { 47 | super(message, cause); 48 | } 49 | 50 | /** Creates a new instance with the given cause. */ 51 | public UncheckedExecutionException(@NullableDecl Throwable cause) { 52 | super(cause); 53 | } 54 | 55 | private static final long serialVersionUID = 0; 56 | } 57 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/UncheckedTimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | package com.google.common.util.concurrent; 16 | 17 | import com.google.common.annotations.GwtIncompatible; 18 | import org.checkerframework.checker.nullness.compatqual.NullableDecl; 19 | 20 | /** 21 | * Unchecked version of {@link java.util.concurrent.TimeoutException}. 22 | * 23 | * @author Kevin Bourrillion 24 | * @since 1.0 25 | */ 26 | @GwtIncompatible 27 | public class UncheckedTimeoutException extends RuntimeException { 28 | public UncheckedTimeoutException() {} 29 | 30 | public UncheckedTimeoutException(@NullableDecl String message) { 31 | super(message); 32 | } 33 | 34 | public UncheckedTimeoutException(@NullableDecl Throwable cause) { 35 | super(cause); 36 | } 37 | 38 | public UncheckedTimeoutException(@NullableDecl String message, @NullableDecl Throwable cause) { 39 | super(message, cause); 40 | } 41 | 42 | private static final long serialVersionUID = 0; 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/util/concurrent/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Concurrency utilities. 17 | * 18 | *

Commonly used types include {@link com.google.common.util.concurrent.ListenableFuture} and 19 | * {@link com.google.common.util.concurrent.Service}. 20 | * 21 | *

Commonly used utilities include {@link com.google.common.util.concurrent.Futures}, {@link 22 | * com.google.common.util.concurrent.MoreExecutors}, and {@link 23 | * com.google.common.util.concurrent.ThreadFactoryBuilder}. 24 | * 25 | *

This package is a part of the open-source Guava 26 | * library. 27 | */ 28 | @CheckReturnValue 29 | @ParametersAreNonnullByDefault 30 | package com.google.common.util.concurrent; 31 | 32 | import com.google.errorprone.annotations.CheckReturnValue; 33 | import javax.annotation.ParametersAreNonnullByDefault; 34 | -------------------------------------------------------------------------------- /src/test/resources/guava-src/com/google/common/xml/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Guava Authors 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 | * in compliance with the License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 | * or implied. See the License for the specific language governing permissions and limitations under 12 | * the License. 13 | */ 14 | 15 | /** 16 | * Escapers 17 | * for 18 | * XML. 19 | * 20 | *

This package is a part of the open-source Guava 21 | * library. 22 | */ 23 | @CheckReturnValue 24 | @ParametersAreNonnullByDefault 25 | package com.google.common.xml; 26 | 27 | import com.google.errorprone.annotations.CheckReturnValue; 28 | import javax.annotation.ParametersAreNonnullByDefault; 29 | -------------------------------------------------------------------------------- /src/test/resources/lexer/CaseInsensitiveLexer.g4: -------------------------------------------------------------------------------- 1 | lexer grammar CaseInsensitiveLexer; 2 | 3 | HELLO : H E L L O ; 4 | WORLD : W O R L D ; 5 | DOCTYPE : '!' D O C T Y P E ; 6 | HEADER1 : H '1' ; 7 | BLANK : '__' B L A N K ; 8 | A : [aA] ; 9 | fragment B : [bB] ; 10 | fragment C : [cC] ; 11 | fragment D : [dD] ; 12 | fragment E : [eE] ; 13 | fragment F : [fF] ; 14 | fragment G : [gG] ; 15 | fragment H : [hH] ; 16 | fragment I : [iI] ; 17 | fragment J : [jJ] ; 18 | fragment K : [kK] ; 19 | fragment L : [lL] ; 20 | fragment M : [mM] ; 21 | fragment N : [nN] ; 22 | fragment O : [oO] ; 23 | fragment P : [pP] ; 24 | fragment Q : [qQ] ; 25 | fragment R : [rR] ; 26 | fragment S : [sS] ; 27 | fragment T : [tT] ; 28 | fragment U : [uU] ; 29 | fragment V : [vV] ; 30 | fragment W : [wW] ; 31 | fragment X : [xX] ; 32 | fragment Y : [yY] ; 33 | fragment Z : [zZ] ; 34 | -------------------------------------------------------------------------------- /src/test/resources/lexer/MultiStateTokensLexer.g4: -------------------------------------------------------------------------------- 1 | lexer grammar MultiStateTokensLexer; 2 | 3 | HELLO : 'HELLO' ; 4 | WORLD : W O R L D ; 5 | fragment LETTER : [a-zA-Z] ; 6 | WORD : (LETTER)+ ; 7 | fragment A : [aA] ; 8 | fragment B : [bB] ; 9 | fragment C : [cC] ; 10 | fragment D : [dD] ; 11 | fragment E : [eE] ; 12 | fragment F : [fF] ; 13 | fragment G : [gG] ; 14 | fragment H : [hH] ; 15 | fragment I : [iI] ; 16 | fragment J : [jJ] ; 17 | fragment K : [kK] ; 18 | fragment L : [lL] ; 19 | fragment M : [mM] ; 20 | fragment N : [nN] ; 21 | fragment O : [oO] ; 22 | fragment P : [pP] ; 23 | fragment Q : [qQ] ; 24 | fragment R : [rR] ; 25 | fragment S : [sS] ; 26 | fragment T : [tT] ; 27 | fragment U : [uU] ; 28 | fragment V : [vV] ; 29 | fragment W : [wW] ; 30 | fragment X : [xX] ; 31 | fragment Y : [yY] ; 32 | fragment Z : [zZ] ; 33 | 34 | mode A; 35 | A_WORD : WORD -> type(WORD) ; 36 | A_NUMBER : NUMBER -> type(NUMBER) ; 37 | A_TWOLETTER : TWOLETTER -> type(TWOLETTER) ; 38 | 39 | mode ALT_DEFAULT; 40 | ALT_DEFAULT_WORD : WORD -> type(WORD) ; 41 | NUMBER : ([0-9])+ ; 42 | TWOLETTER : LETTER LETTER ; 43 | -------------------------------------------------------------------------------- /src/test/resources/lexer/PushPopStateFuncsLexer.g4: -------------------------------------------------------------------------------- 1 | lexer grammar PushPopStateFuncsLexer; 2 | 3 | TEST : 'TEST(' -> pushMode(INSIDE) ; 4 | END : 'END' ; 5 | 6 | mode INSIDE; 7 | LPAREN : '(' -> skip, pushMode(INSIDE) ; 8 | RPAREN : ')' -> skip, popMode ; 9 | -------------------------------------------------------------------------------- /src/test/resources/lexer/UnnamedTokensLexer.g4: -------------------------------------------------------------------------------- 1 | lexer grammar UnnamedTokensLexer; 2 | 3 | SKIP0 : ' ' -> skip ; 4 | SKIP1 : '\t' -> skip ; 5 | SKIP2 : '\n' -> skip ; 6 | SKIP3 : '\r' -> skip ; 7 | SKIP4 : '\f' -> skip ; 8 | MORE0 : '/*' -> more, mode(IN_COMMENT) ; 9 | 10 | mode IN_COMMENT; 11 | IN_COMMENT_SKIP0 : SKIP0 -> skip ; 12 | IN_COMMENT_SKIP1 : SKIP1 -> skip ; 13 | IN_COMMENT_SKIP2 : SKIP2 -> skip ; 14 | IN_COMMENT_SKIP3 : SKIP3 -> skip ; 15 | IN_COMMENT_SKIP4 : SKIP4 -> skip ; 16 | COMMENT : '*/' -> channel(HIDDEN), mode(DEFAULT_MODE) ; 17 | -------------------------------------------------------------------------------- /src/test/resources/lexer/caseInsensitive.jj: -------------------------------------------------------------------------------- 1 | options { 2 | IGNORE_CASE = true; 3 | } 4 | 5 | PARSER_BEGIN(CaseInsensitive) 6 | 7 | public class CaseInsensitive { 8 | public static void main(String[] args) { 9 | } 10 | } 11 | 12 | PARSER_END(CaseInsensitive) 13 | 14 | TOKEN : 15 | { 16 | 17 | | 18 | | 19 | | 20 | | 21 | | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/lexer/multiStateTokens.jj: -------------------------------------------------------------------------------- 1 | PARSER_BEGIN(MultiStateTokens) 2 | 3 | public class MultiStateTokens { 4 | public static void main(String[] args) { 5 | } 6 | } 7 | 8 | PARSER_END(MultiStateTokens) 9 | 10 | TOKEN : 11 | { 12 | 13 | } 14 | 15 | TOKEN [IGNORE_CASE] : 16 | { 17 | 18 | } 19 | 20 | TOKEN : 21 | { 22 | <#LETTER: ["a"-"z","A"-"Z"] > 23 | | )+ > 24 | } 25 | 26 | TOKEN : 27 | { 28 | 29 | | > 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/lexer/pushPopStateFuncs.jj: -------------------------------------------------------------------------------- 1 | PARSER_BEGIN(PushPopStateFuncs) 2 | 3 | public class PushPopStateFuncs { 4 | public static void main(String[] args) { 5 | try { 6 | new PushPopStateFuncs(new java.io.StringReader(args[0])).Start(); 7 | System.out.println("Syntax is okay"); 8 | } catch (Throwable e) { 9 | System.out.println("Syntax is NOT okay: " + e.getMessage()); 10 | } 11 | } 12 | } 13 | 14 | PARSER_END(PushPopStateFuncs) 15 | 16 | TOKEN_MGR_DECLS : { 17 | List lexicalStateStack = new ArrayList(); 18 | 19 | void pushState() { 20 | lexicalStateStack.add(curLexState); 21 | } 22 | 23 | void popState() { 24 | SwitchTo(lexicalStateStack.remove(lexicalStateStack.size() - 1)); 25 | } 26 | 27 | private String pushStateFunc = "pushState"; 28 | private String popStateFunc = "popState"; 29 | } 30 | 31 | SKIP : { 32 | { pushState(); } 33 | | { popState(); } 34 | } 35 | 36 | TOKEN : { 37 | { pushState(); } : INSIDE 38 | | 39 | } 40 | 41 | void Start(): {} { } 42 | -------------------------------------------------------------------------------- /src/test/resources/lexer/unnamedTokens.jj: -------------------------------------------------------------------------------- 1 | PARSER_BEGIN(UnnamedTokens) 2 | 3 | public class UnnamedTokens { 4 | public static void main(String[] args) { 5 | } 6 | } 7 | 8 | PARSER_END(UnnamedTokens) 9 | 10 | SKIP : 11 | { 12 | " " 13 | | "\t" 14 | | "\n" 15 | | "\r" 16 | | "\f" 17 | } 18 | 19 | MORE : 20 | { 21 | "/*" : IN_COMMENT 22 | } 23 | 24 | SPECIAL_TOKEN : 25 | { 26 | : DEFAULT 27 | } 28 | -------------------------------------------------------------------------------- /src/test/resources/parser/BasicsParser.g4: -------------------------------------------------------------------------------- 1 | parser grammar BasicsParser; 2 | 3 | options { tokenVocab=BasicsLexer; } 4 | 5 | singleToken : AMET ; 6 | 7 | singleTokenZeroOrOne : AMET? ; 8 | 9 | singleTokenZeroOrMore : AMET* ; 10 | 11 | singleTokenOneOrMore : AMET+ ; 12 | 13 | singleTokenDoubleQuantified : (AMET+)? ; 14 | 15 | sequence : LOREM IPSUM ; 16 | 17 | sequenceNestedWithAction : LOREM IPSUM DOLOR SIT AMET ; 18 | 19 | sequenceSingle : AMET ; 20 | 21 | sequenceZeroOrOne : (LOREM IPSUM)? ; 22 | 23 | sequenceZeroOrMore : (LOREM IPSUM)* ; 24 | 25 | sequenceOneOrMore : (LOREM IPSUM)+ ; 26 | 27 | choice : (DOLOR | SIT) ; 28 | 29 | choiceWithLookahead : (DOLOR SIT | DOLOR AMET) ; 30 | 31 | tripleNestedChoice : (DOLOR | SIT) ; 32 | 33 | choiceWithDefaultAction : (DOLOR | SIT)? ; 34 | 35 | choiceWithEmptySequence : (DOLOR | SIT)? ; 36 | 37 | choiceOfSequences : (LOREM IPSUM | DOLOR SIT) ; 38 | 39 | choiceWithOptional : (LOREM IPSUM | (DOLOR SIT)?) ; 40 | 41 | choiceEmpty : ; 42 | 43 | choiceZeroOrOne : (DOLOR | SIT)? ; 44 | 45 | choiceZeroOrMore : (DOLOR | SIT)* ; 46 | 47 | choiceOneOrMore : (DOLOR | SIT)+ ; 48 | 49 | sequenceAndChoice : LOREM IPSUM (DOLOR | SIT) ; 50 | 51 | literalCaseMismatch : BEGIN ; 52 | 53 | literalCaseMatch : BEGIN ; 54 | 55 | nonTerminals : choiceEmpty sequence ; 56 | 57 | nonTerminalsInActions : choice ; 58 | 59 | start : BEGIN singleToken sequence choice EOF ; 60 | --------------------------------------------------------------------------------