Skip to content

Instantly share code, notes, and snippets.

@confile
Created February 8, 2015 01:52
Show Gist options
  • Save confile/587c574b257ae5f83b25 to your computer and use it in GitHub Desktop.
Save confile/587c574b257ae5f83b25 to your computer and use it in GitHub Desktop.
31 Cycles with Cycle Finder
http-server:shared mg$ cycle_finder NumberIncrementer.java SomeEvent.java
***** Found reference cycle *****
ReferenceQueue -> (Entry subtype of (field head with type Reference))
Entry -> (superclass WeakReference has (superclass Reference has (field queue with type ReferenceQueue)))
----- Full Types -----
Ljava/lang/ref/ReferenceQueue<>;
Ljava/lang/ClassValue$Entry<>;
***** Found reference cycle *****
Entry -> (superclass Reference has (field queue with type ReferenceQueue))
ReferenceQueue -> (Entry subtype of (field head with type Reference))
----- Full Types -----
Ljava/util/WeakHashMap$Entry<>;
Ljava/lang/ref/ReferenceQueue<>;
***** Found reference cycle *****
WeakReference -> (superclass Reference has (field queue with type ReferenceQueue))
ReferenceQueue -> (WeakReference subtype of (field head with type Reference))
----- Full Types -----
Ljava/lang/ref/WeakReference<>;
Ljava/lang/ref/ReferenceQueue<>;
***** Found reference cycle *****
SoftReference -> (superclass Reference has (field queue with type ReferenceQueue))
ReferenceQueue -> (SoftReference subtype of (field head with type Reference))
----- Full Types -----
Ljava/lang/ref/SoftReference<>;
Ljava/lang/ref/ReferenceQueue<>;
***** Found reference cycle *****
Reference -> (field queue with type ReferenceQueue)
ReferenceQueue -> (field head with type Reference)
----- Full Types -----
Ljava/lang/ref/Reference<>;
Ljava/lang/ref/ReferenceQueue<>;
***** Found reference cycle *****
ClassValue<?> -> (field version with type Version<?>)
Version<?> -> (field classValue with type ClassValue<?>)
----- Full Types -----
Ljava/lang/ClassValue<Ljava/lang/ClassValue$Entry;{0}*>;
Ljava/lang/ClassValue<>.Version<Ljava/lang/ClassValue$Entry;{0}*>;
***** Found reference cycle *****
Entry<?> -> (superclass Reference<Version<?>> has (field referent with type Version<?>))
Version<?> -> (field promise with type Entry<?>)
----- Full Types -----
Ljava/lang/ClassValue<>.Entry<Ljava/lang/ClassValue$Entry;{0}*>;
Ljava/lang/ClassValue<>.Version<Ljava/lang/ClassValue$Entry;{0}*>;
***** Found reference cycle *****
CalendarDate -> (field era with type Era)
Era -> (field sinceDate with type CalendarDate)
----- Full Types -----
Lsun/util/calendar/CalendarDate;
Lsun/util/calendar/Era;
***** Found reference cycle *****
Date -> (superclass CalendarDate has (field era with type Era))
Era -> (Date subtype of (field sinceDate with type CalendarDate))
----- Full Types -----
Lsun/util/calendar/BaseCalendar$Date;
Lsun/util/calendar/Era;
***** Found reference cycle *****
Constructor<Character> -> (MethodRepository subtype of (field genericInfo with type ConstructorRepository))
MethodRepository -> (Class<Character> subtype of (field returnType with type Type))
Class<Character> -> (field cachedConstructor with type Constructor<Character>)
----- Full Types -----
Ljava/lang/reflect/Constructor<Ljava/lang/Character;>;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<Ljava/lang/Character;>;
***** Found reference cycle *****
SoftReference<Method[]> -> (superclass Reference<Method[]> has (field referent with type Method[]))
Method -> (field genericInfo with type MethodRepository)
MethodRepository -> (Class<?> subtype of (field returnType with type Type))
Class<?> -> (field declaredMethods with type SoftReference<Method[]>)
----- Full Types -----
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Method;>;
Ljava/lang/reflect/Method;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<Ljava/lang/Class;{0}*>;
***** Found reference cycle *****
ClassRepository -> (Class<? extends Annotation> subtype of (field superInterfaces with type Type[]))
Class<? extends Annotation> -> (field genericInfo with type ClassRepository)
----- Full Types -----
Lsun/reflect/generics/repository/ClassRepository;
Ljava/lang/Class<Ljava/lang/Class;{0}+Ljava/lang/annotation/Annotation;>;
***** Found reference cycle *****
Constructor<Boolean> -> (field clazz with type Class<Boolean>)
Class<Boolean> -> (field cachedConstructor with type Constructor<Boolean>)
----- Full Types -----
Ljava/lang/reflect/Constructor<Ljava/lang/Boolean;>;
Ljava/lang/Class<Ljava/lang/Boolean;>;
***** Found reference cycle *****
Constructor<?> -> (MethodRepository subtype of (field genericInfo with type ConstructorRepository))
MethodRepository -> (Class<?> subtype of (field returnType with type Type))
Class<?> -> (field cachedConstructor with type Constructor<?>)
----- Full Types -----
Ljava/lang/reflect/Constructor<Ljava/lang/Class;{0}*>;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<Ljava/lang/Class;{0}*>;
***** Found reference cycle *****
Constructor -> (MethodRepository subtype of (field genericInfo with type ConstructorRepository))
MethodRepository -> (Class subtype of (field returnType with type Type))
Class -> (field cachedConstructor with type Constructor)
----- Full Types -----
Ljava/lang/reflect/Constructor<>;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<>;
***** Found reference cycle *****
HashMap<String,Package> -> (field table with type Entry<String,Package>[])
Entry<String,Package> -> (field value with type Package)
Package -> (field loader with type ClassLoader)
ClassLoader -> (field packages with type HashMap<String,Package>)
----- Full Types -----
Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/Package;>;
Ljava/util/HashMap<>.Entry<Ljava/lang/String;Ljava/lang/Package;>;
Ljava/lang/Package;
Ljava/lang/ClassLoader;
***** Found reference cycle *****
Node -> (field thread with type Thread)
Thread -> (field contextClassLoader with type ClassLoader)
ClassLoader -> (field parallelLockMap with type ConcurrentHashMap<String,Object>)
ConcurrentHashMap<String,Object> -> (field segments with type Segment<String,Object>[])
Segment<String,Object> -> (superclass ReentrantLock has (field sync with type Sync))
Sync -> (superclass AbstractQueuedSynchronizer has (field head with type Node))
----- Full Types -----
Ljava/util/concurrent/locks/AbstractQueuedSynchronizer$Node;
Ljava/lang/Thread;
Ljava/lang/ClassLoader;
Ljava/util/concurrent/ConcurrentHashMap<Ljava/lang/String;Ljava/lang/Object;>;
Ljava/util/concurrent/ConcurrentHashMap<>.Segment<Ljava/lang/String;Ljava/lang/Object;>;
Ljava/util/concurrent/locks/ReentrantLock$Sync;
***** Found reference cycle *****
SoftReference<Constructor<Void>[]> -> (superclass Reference<Constructor<Void>[]> has (field referent with type Constructor<Void>[]))
Constructor<Void> -> (MethodRepository subtype of (field genericInfo with type ConstructorRepository))
MethodRepository -> (Class<Void> subtype of (field returnType with type Type))
Class<Void> -> (field declaredConstructors with type SoftReference<Constructor<Void>[]>)
----- Full Types -----
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Constructor<Ljava/lang/Void;>;>;
Ljava/lang/reflect/Constructor<Ljava/lang/Void;>;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<Ljava/lang/Void;>;
***** Found reference cycle *****
Constructor<? extends Annotation> -> (field genericInfo with type ConstructorRepository)
ConstructorRepository -> (Class<? extends Annotation> subtype of (field exceptionTypes with type Type[]))
Class<? extends Annotation> -> (field cachedConstructor with type Constructor<? extends Annotation>)
----- Full Types -----
Ljava/lang/reflect/Constructor<Ljava/lang/Class;{0}+Ljava/lang/annotation/Annotation;>;
Lsun/reflect/generics/repository/ConstructorRepository;
Ljava/lang/Class<Ljava/lang/Class;{0}+Ljava/lang/annotation/Annotation;>;
***** Found reference cycle *****
AccessControlContext -> (field context with type ProtectionDomain[])
ProtectionDomain -> (field classloader with type ClassLoader)
ClassLoader -> (field parallelLockMap with type ConcurrentHashMap<String,Object>)
ConcurrentHashMap<String,Object> -> (field segments with type Segment<String,Object>[])
Segment<String,Object> -> (superclass ReentrantLock has (field sync with type Sync))
Sync -> (superclass AbstractQueuedSynchronizer has (superclass AbstractOwnableSynchronizer has (field exclusiveOwnerThread with type Thread)))
Thread -> (field inheritedAccessControlContext with type AccessControlContext)
----- Full Types -----
Ljava/security/AccessControlContext;
Ljava/security/ProtectionDomain;
Ljava/lang/ClassLoader;
Ljava/util/concurrent/ConcurrentHashMap<Ljava/lang/String;Ljava/lang/Object;>;
Ljava/util/concurrent/ConcurrentHashMap<>.Segment<Ljava/lang/String;Ljava/lang/Object;>;
Ljava/util/concurrent/locks/ReentrantLock$Sync;
Ljava/lang/Thread;
***** Found reference cycle *****
Segment -> (superclass ReentrantLock has (field sync with type Sync))
Sync -> (superclass AbstractQueuedSynchronizer has (superclass AbstractOwnableSynchronizer has (field exclusiveOwnerThread with type Thread)))
Thread -> (field contextClassLoader with type ClassLoader)
ClassLoader -> (field packages with type HashMap<String,Package>)
HashMap<String,Package> -> (field table with type Entry<String,Package>[])
Entry<String,Package> -> (field value with type Package)
Package -> (field packageInfo with type Class)
Class -> (field cachedConstructor with type Constructor)
Constructor -> (ConcurrentHashMap subtype of (field declaredAnnotations with type Map))
ConcurrentHashMap -> (field segments with type Segment[])
----- Full Types -----
Ljava/util/concurrent/ConcurrentHashMap$Segment<>;
Ljava/util/concurrent/locks/ReentrantLock$Sync;
Ljava/lang/Thread;
Ljava/lang/ClassLoader;
Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/Package;>;
Ljava/util/HashMap<>.Entry<Ljava/lang/String;Ljava/lang/Package;>;
Ljava/lang/Package;
Ljava/lang/Class<>;
Ljava/lang/reflect/Constructor<>;
Ljava/util/concurrent/ConcurrentHashMap<>;
***** Found reference cycle *****
SoftReference<Constructor<Boolean>[]> -> (superclass Reference<Constructor<Boolean>[]> has (field referent with type Constructor<Boolean>[]))
Constructor<Boolean> -> (field clazz with type Class<Boolean>)
Class<Boolean> -> (field declaredConstructors with type SoftReference<Constructor<Boolean>[]>)
----- Full Types -----
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Constructor<Ljava/lang/Boolean;>;>;
Ljava/lang/reflect/Constructor<Ljava/lang/Boolean;>;
Ljava/lang/Class<Ljava/lang/Boolean;>;
***** Found reference cycle *****
Key -> (field this$0 with type ProtectionDomain)
ProtectionDomain -> (field key with type Key)
----- Full Types -----
Ljava/security/ProtectionDomain$Key;
Ljava/security/ProtectionDomain;
***** Found reference cycle *****
SoftReference<Constructor<? extends Annotation>[]> -> (superclass Reference<Constructor<? extends Annotation>[]> has (field referent with type Constructor<? extends Annotation>[]))
Constructor<? extends Annotation> -> (field genericInfo with type ConstructorRepository)
ConstructorRepository -> (Class<? extends Annotation> subtype of (field exceptionTypes with type Type[]))
Class<? extends Annotation> -> (field declaredConstructors with type SoftReference<Constructor<? extends Annotation>[]>)
----- Full Types -----
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Constructor<Ljava/lang/Class;{0}+Ljava/lang/annotation/Annotation;>;>;
Ljava/lang/reflect/Constructor<Ljava/lang/Class;{0}+Ljava/lang/annotation/Annotation;>;
Lsun/reflect/generics/repository/ConstructorRepository;
Ljava/lang/Class<Ljava/lang/Class;{0}+Ljava/lang/annotation/Annotation;>;
***** Found reference cycle *****
SoftReference<Constructor<Character>[]> -> (superclass Reference<Constructor<Character>[]> has (field referent with type Constructor<Character>[]))
Constructor<Character> -> (MethodRepository subtype of (field genericInfo with type ConstructorRepository))
MethodRepository -> (Class<Character> subtype of (field returnType with type Type))
Class<Character> -> (field declaredConstructors with type SoftReference<Constructor<Character>[]>)
----- Full Types -----
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Constructor<Ljava/lang/Character;>;>;
Ljava/lang/reflect/Constructor<Ljava/lang/Character;>;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<Ljava/lang/Character;>;
***** Found reference cycle *****
SoftReference<Constructor<?>[]> -> (superclass Reference<Constructor<?>[]> has (field referent with type Constructor<?>[]))
Constructor<?> -> (MethodRepository subtype of (field genericInfo with type ConstructorRepository))
MethodRepository -> (Class<?> subtype of (field returnType with type Type))
Class<?> -> (field declaredConstructors with type SoftReference<Constructor<?>[]>)
----- Full Types -----
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Constructor<Ljava/lang/Class;{0}*>;>;
Ljava/lang/reflect/Constructor<Ljava/lang/Class;{0}*>;
Lsun/reflect/generics/repository/MethodRepository;
Ljava/lang/Class<Ljava/lang/Class;{0}*>;
***** Found reference cycle *****
FieldRepository -> (Class<Void> subtype of (field genericType with type Type))
Class<Void> -> (field declaredFields with type SoftReference<Field[]>)
SoftReference<Field[]> -> (superclass Reference<Field[]> has (field referent with type Field[]))
Field -> (field genericInfo with type FieldRepository)
----- Full Types -----
Lsun/reflect/generics/repository/FieldRepository;
Ljava/lang/Class<Ljava/lang/Void;>;
Ljava/lang/ref/SoftReference<[Ljava/lang/reflect/Field;>;
Ljava/lang/reflect/Field;
***** Found reference cycle *****
ClassValueMap -> (field type with type Class<?>)
Class<?> -> (field classValueMap with type ClassValueMap)
----- Full Types -----
Ljava/lang/ClassValue<>.ClassValueMap;
Ljava/lang/Class<Ljava/lang/Class;{0}*>;
***** Found reference cycle *****
AnnotationType -> (ConcurrentHashMap<String,Object> subtype of (field memberDefaults with type Map<String,Object>))
ConcurrentHashMap<String,Object> -> (field segments with type Segment<String,Object>[])
Segment<String,Object> -> (superclass ReentrantLock has (field sync with type Sync))
Sync -> (superclass AbstractQueuedSynchronizer has (superclass AbstractOwnableSynchronizer has (field exclusiveOwnerThread with type Thread)))
Thread -> (field contextClassLoader with type ClassLoader)
ClassLoader -> (field packages with type HashMap<String,Package>)
HashMap<String,Package> -> (field table with type Entry<String,Package>[])
Entry<String,Package> -> (field value with type Package)
Package -> (field packageInfo with type Class)
Class -> (field annotationType with type AnnotationType)
----- Full Types -----
Lsun/reflect/annotation/AnnotationType;
Ljava/util/concurrent/ConcurrentHashMap<Ljava/lang/String;Ljava/lang/Object;>;
Ljava/util/concurrent/ConcurrentHashMap<>.Segment<Ljava/lang/String;Ljava/lang/Object;>;
Ljava/util/concurrent/locks/ReentrantLock$Sync;
Ljava/lang/Thread;
Ljava/lang/ClassLoader;
Ljava/util/HashMap<Ljava/lang/String;Ljava/lang/Package;>;
Ljava/util/HashMap<>.Entry<Ljava/lang/String;Ljava/lang/Package;>;
Ljava/lang/Package;
Ljava/lang/Class<>;
***** Found reference cycle *****
ThreadGroup -> (field threads with type Thread[])
Thread -> (field group with type ThreadGroup)
----- Full Types -----
Ljava/lang/ThreadGroup;
Ljava/lang/Thread;
***** Found reference cycle *****
Version -> (field classValue with type ClassValue)
ClassValue -> (field version with type Version)
----- Full Types -----
Ljava/lang/ClassValue$Version<>;
Ljava/lang/ClassValue<>;
31 CYCLES FOUND.
@brunobowden
Copy link

I've seen a lot of similar cycles in my own use of the tool.

  1. Should this just be ignored?
  2. Should we construct a standard whitelist file for common false positives like this?

***** Found reference cycle *****
ReferenceQueue -> (Entry subtype of (field head with type Reference))
Entry -> (superclass Reference has (field queue with type ReferenceQueue))
----- Full Types -----
Ljava/lang/ref/ReferenceQueue<>;
Ljava/lang/ClassValue$Entry<>;

***** Found reference cycle *****
Entry -> (superclass Reference has (field queue with type ReferenceQueue))
ReferenceQueue -> (Entry subtype of (field head with type Reference))
----- Full Types -----
Ljava/util/WeakHashMap$Entry<>;
Ljava/lang/ref/ReferenceQueue<>;

***** Found reference cycle *****
WeakReference -> (superclass Reference has (field queue with type ReferenceQueue))
ReferenceQueue -> (WeakReference subtype of (field head with type Reference))
----- Full Types -----
Ljava/lang/ref/WeakReference<>;
Ljava/lang/ref/ReferenceQueue<>;

***** Found reference cycle *****
SoftReference -> (superclass Reference has (field queue with type ReferenceQueue))
ReferenceQueue -> (SoftReference subtype of (field head with type Reference))
----- Full Types -----
Ljava/lang/ref/SoftReference<>;
Ljava/lang/ref/ReferenceQueue<>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment