diff --git a/spine-libgdx/spine-libgdx/.settings/org.eclipse.jdt.core.prefs b/spine-libgdx/spine-libgdx/.settings/org.eclipse.jdt.core.prefs index 13db62da1..95f665389 100644 --- a/spine-libgdx/spine-libgdx/.settings/org.eclipse.jdt.core.prefs +++ b/spine-libgdx/spine-libgdx/.settings/org.eclipse.jdt.core.prefs @@ -2,26 +2,31 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=com.esotericsoftware.spine.utils.Null +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=ignore org.eclipse.jdt.core.compiler.problem.deprecation=ignore org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -29,7 +34,7 @@ org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning @@ -40,61 +45,70 @@ org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedImport=ignore org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.7 diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java index 637f6447c..c293e11e1 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java @@ -40,6 +40,7 @@ import com.badlogic.gdx.utils.ObjectSet; import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.VertexAttachment; +import com.esotericsoftware.spine.utils.Null; /** Stores a list of timelines to animate a skeleton's pose over time. */ public class Animation { @@ -69,7 +70,7 @@ public class Animation { timelineIds.addAll(timelines.get(i).getPropertyIds()); } - /** Returns true if this animation contains a timeline with any of the specified property IDs. **/ + /** Returns true if this animation contains a timeline with any of the specified property IDs. */ public boolean hasTimeline (String[] propertyIds) { for (String id : propertyIds) if (timelineIds.contains(id)) return true; @@ -106,7 +107,7 @@ public class Animation { * @param blend Controls how mixing is applied when alpha < 1. * @param direction Indicates whether the timelines are mixing in or out. Used by timelines which perform instant transitions, * such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */ - public void apply (Skeleton skeleton, float lastTime, float time, boolean loop, Array events, float alpha, + public void apply (Skeleton skeleton, float lastTime, float time, boolean loop, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); @@ -249,8 +250,8 @@ public class Animation { * @param blend Controls how mixing is applied when alpha < 1. * @param direction Indicates whether the timeline is mixing in or out. Used by timelines which perform instant transitions, * such as {@link DrawOrderTimeline} or {@link AttachmentTimeline}. */ - abstract public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, - MixDirection direction); + abstract public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, + MixBlend blend, MixDirection direction); } /** An interface for timelines which change the property of a bone. */ @@ -454,7 +455,7 @@ public class Animation { return boneIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Bone bone = skeleton.bones.get(boneIndex); @@ -501,7 +502,7 @@ public class Animation { return boneIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Bone bone = skeleton.bones.get(boneIndex); @@ -573,7 +574,7 @@ public class Animation { return boneIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Bone bone = skeleton.bones.get(boneIndex); @@ -686,7 +687,7 @@ public class Animation { return boneIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Bone bone = skeleton.bones.get(boneIndex); @@ -776,7 +777,7 @@ public class Animation { frames[frame + A] = a; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Slot slot = skeleton.slots.get(slotIndex); @@ -873,7 +874,7 @@ public class Animation { frames[frame + B2] = b2; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Slot slot = skeleton.slots.get(slotIndex); @@ -978,7 +979,7 @@ public class Animation { attachmentNames[frame] = attachmentName; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Slot slot = skeleton.slots.get(slotIndex); @@ -1094,7 +1095,7 @@ public class Animation { return y + (1 - y) * (time - x) / (frames[frame + getFrameEntries()] - x); } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Slot slot = skeleton.slots.get(slotIndex); @@ -1301,8 +1302,8 @@ public class Animation { } /** Fires events for frames > lastTime and <= time. */ - public void apply (Skeleton skeleton, float lastTime, float time, Array firedEvents, float alpha, MixBlend blend, - MixDirection direction) { + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array firedEvents, float alpha, + MixBlend blend, MixDirection direction) { if (firedEvents == null) return; @@ -1353,12 +1354,12 @@ public class Animation { * @param time The frame time in seconds. * @param drawOrder For each slot in {@link Skeleton#slots}, the index of the slot in the new draw order. May be null to use * setup pose draw order. */ - public void setFrame (int frame, float time, int[] drawOrder) { + public void setFrame (int frame, float time, @Null int[] drawOrder) { frames[frame] = time; drawOrders[frame] = drawOrder; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { Array drawOrder = skeleton.drawOrder; @@ -1421,7 +1422,7 @@ public class Animation { frames[frame + STRETCH] = stretch ? 1 : 0; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { IkConstraint constraint = skeleton.ikConstraints.get(ikConstraintIndex); @@ -1526,7 +1527,7 @@ public class Animation { frames[frame + SHEAR] = shearMix; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { TransformConstraint constraint = skeleton.transformConstraints.get(transformConstraintIndex); @@ -1609,7 +1610,7 @@ public class Animation { return pathConstraintIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex); @@ -1649,7 +1650,7 @@ public class Animation { return pathConstraintIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex); @@ -1690,7 +1691,7 @@ public class Animation { return pathConstraintIndex; } - public void apply (Skeleton skeleton, float lastTime, float time, Array events, float alpha, MixBlend blend, + public void apply (Skeleton skeleton, float lastTime, float time, @Null Array events, float alpha, MixBlend blend, MixDirection direction) { PathConstraint constraint = skeleton.pathConstraints.get(pathConstraintIndex); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java index 481407b7d..be2068cc5 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/AnimationState.java @@ -44,6 +44,7 @@ import com.esotericsoftware.spine.Animation.MixBlend; import com.esotericsoftware.spine.Animation.MixDirection; import com.esotericsoftware.spine.Animation.RotateTimeline; import com.esotericsoftware.spine.Animation.Timeline; +import com.esotericsoftware.spine.utils.Null; /** Applies animations over time, queues animations for later playback, mixes (crossfading) between animations, and applies * multiple animations on top of each other (layering). @@ -502,7 +503,7 @@ public class AnimationState { /** Sets an animation by name. *

- * {@link #setAnimation(int, Animation, boolean)}. */ + * See {@link #setAnimation(int, Animation, boolean)}. */ public TrackEntry setAnimation (int trackIndex, String animationName, boolean loop) { Animation animation = data.skeletonData.findAnimation(animationName); if (animation == null) throw new IllegalArgumentException("Animation not found: " + animationName); @@ -649,8 +650,7 @@ public class AnimationState { return null; } - /** @param last May be null. */ - private TrackEntry trackEntry (int trackIndex, Animation animation, boolean loop, TrackEntry last) { + private TrackEntry trackEntry (int trackIndex, Animation animation, boolean loop, @Null TrackEntry last) { TrackEntry entry = trackEntryPool.obtain(); entry.trackIndex = trackIndex; entry.animation = animation; @@ -772,6 +772,7 @@ public class AnimationState { } /** Returns the track entry for the animation currently playing on the track, or null if no animation is currently playing. */ + @Null public TrackEntry getCurrent (int trackIndex) { if (trackIndex < 0) throw new IllegalArgumentException("trackIndex must be >= 0."); if (trackIndex >= tracks.size) return null; @@ -1009,12 +1010,12 @@ public class AnimationState { *

* A track entry returned from {@link AnimationState#setAnimation(int, Animation, boolean)} is already the current animation * for the track, so the track entry listener {@link AnimationStateListener#start(TrackEntry)} will not be called. */ + @Null public AnimationStateListener getListener () { return listener; } - /** @param listener May be null. */ - public void setListener (AnimationStateListener listener) { + public void setListener (@Null AnimationStateListener listener) { this.listener = listener; } @@ -1065,6 +1066,7 @@ public class AnimationState { } /** The animation queued to start after this animation, or null. next makes up a linked list. */ + @Null public TrackEntry getNext () { return next; } @@ -1124,12 +1126,14 @@ public class AnimationState { /** The track entry for the previous animation when mixing from the previous animation to this animation, or null if no * mixing is currently occuring. When mixing from multiple animations, mixingFrom makes up a linked list. */ + @Null public TrackEntry getMixingFrom () { return mixingFrom; } /** The track entry for the next animation when mixing from this animation to the next animation, or null if no mixing is * currently occuring. When mixing to multiple animations, mixingTo makes up a linked list. */ + @Null public TrackEntry getMixingTo () { return mixingTo; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java index cb8d33daa..4c38ae839 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Bone.java @@ -37,6 +37,7 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import com.esotericsoftware.spine.BoneData.TransformMode; +import com.esotericsoftware.spine.utils.Null; /** Stores a bone's current pose. *

@@ -56,8 +57,7 @@ public class Bone implements Updatable { boolean sorted, active; - /** @param parent May be null. */ - public Bone (BoneData data, Skeleton skeleton, Bone parent) { + public Bone (BoneData data, Skeleton skeleton, @Null Bone parent) { if (data == null) throw new IllegalArgumentException("data cannot be null."); if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); this.data = data; @@ -66,9 +66,8 @@ public class Bone implements Updatable { setToSetupPose(); } - /** Copy constructor. Does not copy the children bones. - * @param parent May be null. */ - public Bone (Bone bone, Skeleton skeleton, Bone parent) { + /** Copy constructor. Does not copy the children bones. */ + public Bone (Bone bone, Skeleton skeleton, @Null Bone parent) { if (bone == null) throw new IllegalArgumentException("bone cannot be null."); if (skeleton == null) throw new IllegalArgumentException("skeleton cannot be null."); this.skeleton = skeleton; @@ -226,6 +225,7 @@ public class Bone implements Updatable { } /** The parent bone, or null if this is the root bone. */ + @Null public Bone getParent () { return parent; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BoneData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BoneData.java index 1238fafc7..c4d952007 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BoneData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/BoneData.java @@ -31,6 +31,8 @@ package com.esotericsoftware.spine; import com.badlogic.gdx.graphics.Color; +import com.esotericsoftware.spine.utils.Null; + /** Stores the setup pose for a {@link Bone}. */ public class BoneData { final int index; @@ -44,8 +46,7 @@ public class BoneData { // Nonessential. final Color color = new Color(0.61f, 0.61f, 0.61f, 1); // 9b9b9bff - /** @param parent May be null. */ - public BoneData (int index, String name, BoneData parent) { + public BoneData (int index, String name, @Null BoneData parent) { if (index < 0) throw new IllegalArgumentException("index must be >= 0."); if (name == null) throw new IllegalArgumentException("name cannot be null."); this.index = index; @@ -53,9 +54,8 @@ public class BoneData { this.parent = parent; } - /** Copy constructor. - * @param parent May be null. */ - public BoneData (BoneData bone, BoneData parent) { + /** Copy constructor. */ + public BoneData (BoneData bone, @Null BoneData parent) { if (bone == null) throw new IllegalArgumentException("bone cannot be null."); index = bone.index; name = bone.name; @@ -80,7 +80,7 @@ public class BoneData { return name; } - /** @return May be null. */ + @Null public BoneData getParent () { return parent; } @@ -179,7 +179,8 @@ public class BoneData { /** When true, {@link Skeleton#updateWorldTransform()} only updates this bone if the {@link Skeleton#getSkin()} contains this * bone. - * @see Skin#getBones() */ + *

+ * See {@link Skin#getBones()}. */ public boolean getSkinRequired () { return skinRequired; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/ConstraintData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/ConstraintData.java index a81fb08f1..3b64fcc20 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/ConstraintData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/ConstraintData.java @@ -57,7 +57,8 @@ abstract public class ConstraintData { /** When true, {@link Skeleton#updateWorldTransform()} only updates this constraint if the {@link Skeleton#getSkin()} contains * this constraint. - * @see Skin#getConstraints() */ + *

+ * See {@link Skin#getConstraints()}. */ public boolean getSkinRequired () { return skinRequired; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java index 341090ae2..2db49badd 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skeleton.java @@ -41,6 +41,7 @@ import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.MeshAttachment; import com.esotericsoftware.spine.attachments.PathAttachment; import com.esotericsoftware.spine.attachments.RegionAttachment; +import com.esotericsoftware.spine.utils.Null; /** Stores the current pose for a skeleton. *

@@ -472,15 +473,14 @@ public class Skeleton { return updateCache; } - /** Returns the root bone, or null. */ + /** Returns the root bone, or null if the skeleton has no bones. */ public Bone getRootBone () { - if (bones.size == 0) return null; - return bones.first(); + return bones.size == 0 ? null : bones.first(); } /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it - * repeatedly. - * @return May be null. */ + * repeatedly. */ + @Null public Bone findBone (String boneName) { if (boneName == null) throw new IllegalArgumentException("boneName cannot be null."); Array bones = this.bones; @@ -497,8 +497,8 @@ public class Skeleton { } /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it - * repeatedly. - * @return May be null. */ + * repeatedly. */ + @Null public Slot findSlot (String slotName) { if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); Array slots = this.slots; @@ -519,8 +519,8 @@ public class Skeleton { this.drawOrder = drawOrder; } - /** The skeleton's current skin. - * @return May be null. */ + /** The skeleton's current skin. */ + @Null public Skin getSkin () { return skin; } @@ -542,9 +542,9 @@ public class Skeleton { *

* After changing the skin, the visible attachments can be reset to those attached in the setup pose by calling * {@link #setSlotsToSetupPose()}. Also, often {@link AnimationState#apply(Skeleton)} is called before the next time the - * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new skin. - * @param newSkin May be null. */ - public void setSkin (Skin newSkin) { + * skeleton is rendered to allow any attachment keys in the current animation(s) to hide or show attachments from the new + * skin. */ + public void setSkin (@Null Skin newSkin) { if (newSkin == skin) return; if (newSkin != null) { if (skin != null) @@ -568,8 +568,8 @@ public class Skeleton { /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot name and attachment * name. *

- * See {@link #getAttachment(int, String)}. - * @return May be null. */ + * See {@link #getAttachment(int, String)}. */ + @Null public Attachment getAttachment (String slotName, String attachmentName) { SlotData slot = data.findSlot(slotName); if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName); @@ -579,8 +579,8 @@ public class Skeleton { /** Finds an attachment by looking in the {@link #skin} and {@link SkeletonData#defaultSkin} using the slot index and * attachment name. First the skin is checked and if the attachment was not found, the default skin is checked. *

- * See Runtime skins in the Spine Runtimes Guide. - * @return May be null. */ + * See Runtime skins in the Spine Runtimes Guide. */ + @Null public Attachment getAttachment (int slotIndex, String attachmentName) { if (attachmentName == null) throw new IllegalArgumentException("attachmentName cannot be null."); if (skin != null) { @@ -594,7 +594,7 @@ public class Skeleton { /** A convenience method to set an attachment by finding the slot with {@link #findSlot(String)}, finding the attachment with * {@link #getAttachment(int, String)}, then setting the slot's {@link Slot#attachment}. * @param attachmentName May be null to clear the slot's attachment. */ - public void setAttachment (String slotName, String attachmentName) { + public void setAttachment (String slotName, @Null String attachmentName) { if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); Slot slot = findSlot(slotName); if (slot == null) throw new IllegalArgumentException("Slot not found: " + slotName); @@ -613,8 +613,8 @@ public class Skeleton { } /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method - * than to call it repeatedly. - * @return May be null. */ + * than to call it repeatedly. */ + @Null public IkConstraint findIkConstraint (String constraintName) { if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); Array ikConstraints = this.ikConstraints; @@ -631,8 +631,8 @@ public class Skeleton { } /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of - * this method than to call it repeatedly. - * @return May be null. */ + * this method than to call it repeatedly. */ + @Null public TransformConstraint findTransformConstraint (String constraintName) { if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); Array transformConstraints = this.transformConstraints; @@ -649,8 +649,8 @@ public class Skeleton { } /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method - * than to call it repeatedly. - * @return May be null. */ + * than to call it repeatedly. */ + @Null public PathConstraint findPathConstraint (String constraintName) { if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); Array pathConstraints = this.pathConstraints; diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java index 3967bb232..2147fd248 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBinary.java @@ -76,6 +76,7 @@ import com.esotericsoftware.spine.attachments.PathAttachment; import com.esotericsoftware.spine.attachments.PointAttachment; import com.esotericsoftware.spine.attachments.RegionAttachment; import com.esotericsoftware.spine.attachments.VertexAttachment; +import com.esotericsoftware.spine.utils.Null; /** Loads skeleton data in the Spine binary format. *

@@ -138,7 +139,7 @@ public class SkeletonBinary { try { skeletonData.hash = input.readString(); if (skeletonData.hash.isEmpty()) skeletonData.hash = null; - skeletonData.version = input.readString(); + skeletonData.version = input.readString(); if (skeletonData.version.isEmpty()) skeletonData.version = null; if ("3.8.75".equals(skeletonData.version)) throw new RuntimeException("Unsupported skeleton data, please export with a newer version of Spine."); @@ -330,7 +331,7 @@ public class SkeletonBinary { return skeletonData; } - /** @return May be null. */ + @Null private Skin readSkin (SkeletonInput input, SkeletonData skeletonData, boolean defaultSkin, boolean nonessential) throws IOException { @@ -773,7 +774,9 @@ public class SkeletonBinary { for (int ii = 0, nn = input.readInt(true); ii < nn; ii++) { int slotIndex = input.readInt(true); for (int iii = 0, nnn = input.readInt(true); iii < nnn; iii++) { - VertexAttachment attachment = (VertexAttachment)skin.getAttachment(slotIndex, input.readStringRef()); + String attachmentName = input.readStringRef(); + VertexAttachment attachment = (VertexAttachment)skin.getAttachment(slotIndex, attachmentName); + if (attachment == null) throw new SerializationException("Vertex attachment not found: " + attachmentName); boolean weighted = attachment.getBones() != null; float[] vertices = attachment.getVertices(); int deformLength = weighted ? (vertices.length / 3) << 1 : vertices.length; @@ -937,7 +940,7 @@ public class SkeletonBinary { super(file.read(512)); } - /** @return May be null. */ + @Null public String readStringRef () throws IOException { int index = readInt(true); return index == 0 ? null : strings.get(index - 1); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBounds.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBounds.java index d102b8143..8c904fd18 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBounds.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonBounds.java @@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.FloatArray; import com.badlogic.gdx.utils.Pool; import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.BoundingBoxAttachment; +import com.esotericsoftware.spine.utils.Null; /** Collects each visible {@link BoundingBoxAttachment} and computes the world vertices for its polygon. The polygon vertices are * provided along with convenience methods for doing hit detection. */ @@ -141,6 +142,7 @@ public class SkeletonBounds { /** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more * efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true. */ + @Null public BoundingBoxAttachment containsPoint (float x, float y) { Array polygons = this.polygons; for (int i = 0, n = polygons.size; i < n; i++) @@ -171,6 +173,7 @@ public class SkeletonBounds { /** Returns the first bounding box attachment that contains any part of the line segment, or null. When doing many checks, it * is usually more efficient to only call this method if {@link #aabbIntersectsSegment(float, float, float, float)} returns * true. */ + @Null public BoundingBoxAttachment intersectsSegment (float x1, float y1, float x2, float y2) { Array polygons = this.polygons; for (int i = 0, n = polygons.size; i < n; i++) @@ -244,6 +247,7 @@ public class SkeletonBounds { } /** Returns the polygon for the specified bounding box, or null. */ + @Null public FloatArray getPolygon (BoundingBoxAttachment boundingBox) { if (boundingBox == null) throw new IllegalArgumentException("boundingBox cannot be null."); int index = boundingBoxes.indexOf(boundingBox, true); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonData.java index 52edc3c18..c23f1138e 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonData.java @@ -31,6 +31,8 @@ package com.esotericsoftware.spine; import com.badlogic.gdx.utils.Array; +import com.esotericsoftware.spine.utils.Null; + /** Stores the setup pose and all of the stateless data for a skeleton. *

* See Data objects in the Spine Runtimes @@ -65,8 +67,8 @@ public class SkeletonData { } /** Finds a bone by comparing each bone's name. It is more efficient to cache the results of this method than to call it - * multiple times. - * @return May be null. */ + * multiple times. */ + @Null public BoneData findBone (String boneName) { if (boneName == null) throw new IllegalArgumentException("boneName cannot be null."); Array bones = this.bones; @@ -85,8 +87,8 @@ public class SkeletonData { } /** Finds a slot by comparing each slot's name. It is more efficient to cache the results of this method than to call it - * multiple times. - * @return May be null. */ + * multiple times. */ + @Null public SlotData findSlot (String slotName) { if (slotName == null) throw new IllegalArgumentException("slotName cannot be null."); Array slots = this.slots; @@ -101,20 +103,19 @@ public class SkeletonData { /** The skeleton's default skin. By default this skin contains all attachments that were not in a skin in Spine. *

- * See {@link Skeleton#getAttachment(int, String)}. - * @return May be null. */ + * See {@link Skeleton#getAttachment(int, String)}. */ + @Null public Skin getDefaultSkin () { return defaultSkin; } - /** @param defaultSkin May be null. */ - public void setDefaultSkin (Skin defaultSkin) { + public void setDefaultSkin (@Null Skin defaultSkin) { this.defaultSkin = defaultSkin; } /** Finds a skin by comparing each skin's name. It is more efficient to cache the results of this method than to call it - * multiple times. - * @return May be null. */ + * multiple times. */ + @Null public Skin findSkin (String skinName) { if (skinName == null) throw new IllegalArgumentException("skinName cannot be null."); for (Skin skin : skins) @@ -130,8 +131,8 @@ public class SkeletonData { // --- Events. /** Finds an event by comparing each events's name. It is more efficient to cache the results of this method than to call it - * multiple times. - * @return May be null. */ + * multiple times. */ + @Null public EventData findEvent (String eventDataName) { if (eventDataName == null) throw new IllegalArgumentException("eventDataName cannot be null."); for (EventData eventData : events) @@ -152,8 +153,8 @@ public class SkeletonData { } /** Finds an animation by comparing each animation's name. It is more efficient to cache the results of this method than to - * call it multiple times. - * @return May be null. */ + * call it multiple times. */ + @Null public Animation findAnimation (String animationName) { if (animationName == null) throw new IllegalArgumentException("animationName cannot be null."); Array animations = this.animations; @@ -172,8 +173,8 @@ public class SkeletonData { } /** Finds an IK constraint by comparing each IK constraint's name. It is more efficient to cache the results of this method - * than to call it multiple times. - * @return May be null. */ + * than to call it multiple times. */ + @Null public IkConstraintData findIkConstraint (String constraintName) { if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); Array ikConstraints = this.ikConstraints; @@ -192,8 +193,8 @@ public class SkeletonData { } /** Finds a transform constraint by comparing each transform constraint's name. It is more efficient to cache the results of - * this method than to call it multiple times. - * @return May be null. */ + * this method than to call it multiple times. */ + @Null public TransformConstraintData findTransformConstraint (String constraintName) { if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); Array transformConstraints = this.transformConstraints; @@ -212,8 +213,8 @@ public class SkeletonData { } /** Finds a path constraint by comparing each path constraint's name. It is more efficient to cache the results of this method - * than to call it multiple times. - * @return May be null. */ + * than to call it multiple times. */ + @Null public PathConstraintData findPathConstraint (String constraintName) { if (constraintName == null) throw new IllegalArgumentException("constraintName cannot be null."); Array pathConstraints = this.pathConstraints; @@ -226,14 +227,13 @@ public class SkeletonData { // --- - /** The skeleton's name, which by default is the name of the skeleton data file, if possible. - * @return May be null. */ + /** The skeleton's name, which by default is the name of the skeleton data file, if possible. */ + @Null public String getName () { return name; } - /** @param name May be null. */ - public void setName (String name) { + public void setName (@Null String name) { this.name = name; } @@ -274,45 +274,42 @@ public class SkeletonData { } /** The Spine version used to export the skeleton data, or null. */ + @Null public String getVersion () { return version; } - /** @param version May be null. */ - public void setVersion (String version) { + public void setVersion (@Null String version) { this.version = version; } - /** The skeleton data hash. This value will change if any of the skeleton data has changed. - * @return May be null. */ + /** The skeleton data hash. This value will change if any of the skeleton data has changed. */ + @Null public String getHash () { return hash; } - /** @param hash May be null. */ - public void setHash (String hash) { + public void setHash (@Null String hash) { this.hash = hash; } - /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. - * @return May be null. */ + /** The path to the images directory as defined in Spine. Available only when nonessential data was exported. */ + @Null public String getImagesPath () { return imagesPath; } - /** @param imagesPath May be null. */ - public void setImagesPath (String imagesPath) { + public void setImagesPath (@Null String imagesPath) { this.imagesPath = imagesPath; } - /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. - * @return May be null. */ + /** The path to the audio directory as defined in Spine. Available only when nonessential data was exported. */ + @Null public String getAudioPath () { return audioPath; } - /** @param audioPath May be null. */ - public void setAudioPath (String audioPath) { + public void setAudioPath (@Null String audioPath) { this.audioPath = audioPath; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java index 31fbb2169..bc2e3a70a 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SkeletonRenderer.java @@ -44,6 +44,7 @@ import com.esotericsoftware.spine.attachments.ClippingAttachment; import com.esotericsoftware.spine.attachments.MeshAttachment; import com.esotericsoftware.spine.attachments.RegionAttachment; import com.esotericsoftware.spine.attachments.SkeletonAttachment; +import com.esotericsoftware.spine.utils.Null; import com.esotericsoftware.spine.utils.SkeletonClipping; import com.esotericsoftware.spine.utils.TwoColorPolygonBatch; @@ -450,13 +451,12 @@ public class SkeletonRenderer { this.premultipliedAlpha = premultipliedAlpha; } - /** @return May be null. */ + @Null public VertexEffect getVertexEffect () { return vertexEffect; } - /** @param vertexEffect May be null. */ - public void setVertexEffect (VertexEffect vertexEffect) { + public void setVertexEffect (@Null VertexEffect vertexEffect) { this.vertexEffect = vertexEffect; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java index a593c11e1..58baba52a 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Skin.java @@ -34,6 +34,7 @@ import com.badlogic.gdx.utils.OrderedSet; import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.MeshAttachment; +import com.esotericsoftware.spine.utils.Null; /** Stores attachments by slot index and attachment name. *

@@ -93,6 +94,7 @@ public class Skin { } /** Returns the attachment for the specified slot index and name, or null. */ + @Null public Attachment getAttachment (int slotIndex, String name) { lookup.set(slotIndex, name); SkinEntry entry = attachments.get(lookup); @@ -154,15 +156,14 @@ public class Skin { } } - /** Stores an entry in the skin consisting of the slot index, name, and attachment **/ + /** Stores an entry in the skin consisting of the slot index and the attachment name. */ static public class SkinEntry { int slotIndex; String name; Attachment attachment; private int hashCode; - /** @param attachment May be null. */ - SkinEntry (int slotIndex, String name, Attachment attachment) { + SkinEntry (int slotIndex, String name, @Null Attachment attachment) { set(slotIndex, name); this.attachment = attachment; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java index 8a5bbca9a..70831c31e 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Slot.java @@ -35,6 +35,7 @@ import com.badlogic.gdx.utils.FloatArray; import com.esotericsoftware.spine.Animation.DeformTimeline; import com.esotericsoftware.spine.attachments.Attachment; import com.esotericsoftware.spine.attachments.VertexAttachment; +import com.esotericsoftware.spine.utils.Null; /** Stores a slot's current pose. Slots organize attachments for {@link Skeleton#drawOrder} purposes and provide a place to store * state for an attachment. State cannot be stored in an attachment itself because attachments are stateless and may be shared @@ -92,18 +93,19 @@ public class Slot { /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark * color's alpha is not used. */ + @Null public Color getDarkColor () { return darkColor; } /** The current attachment for the slot, or null if the slot has no attachment. */ + @Null public Attachment getAttachment () { return attachment; } - /** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}. - * @param attachment May be null. */ - public void setAttachment (Attachment attachment) { + /** Sets the slot's attachment and, if the attachment changed, resets {@link #attachmentTime} and clears {@link #deform}. */ + public void setAttachment (@Null Attachment attachment) { if (this.attachment == attachment) return; this.attachment = attachment; attachmentTime = bone.skeleton.time; diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SlotData.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SlotData.java index 3a0033af2..bb5b5dfaa 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SlotData.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/SlotData.java @@ -31,6 +31,8 @@ package com.esotericsoftware.spine; import com.badlogic.gdx.graphics.Color; +import com.esotericsoftware.spine.utils.Null; + /** Stores the setup pose for a {@link Slot}. */ public class SlotData { final int index; @@ -73,21 +75,21 @@ public class SlotData { /** The dark color used to tint the slot's attachment for two color tinting, or null if two color tinting is not used. The dark * color's alpha is not used. */ + @Null public Color getDarkColor () { return darkColor; } - /** @param darkColor May be null. */ - public void setDarkColor (Color darkColor) { + public void setDarkColor (@Null Color darkColor) { this.darkColor = darkColor; } - /** @param attachmentName May be null. */ - public void setAttachmentName (String attachmentName) { + public void setAttachmentName (@Null String attachmentName) { this.attachmentName = attachmentName; } /** The name of the attachment that is visible for this slot in the setup pose, or null if no attachment is visible. */ + @Null public String getAttachmentName () { return attachmentName; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/Attachment.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/Attachment.java index 3aca3fe6c..e590f9333 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/Attachment.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/Attachment.java @@ -47,6 +47,6 @@ abstract public class Attachment { return name; } - /** Returns a copy of the attachment. **/ + /** Returns a copy of the attachment. */ abstract public Attachment copy (); } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/AttachmentLoader.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/AttachmentLoader.java index 4599ef307..0f0fb27ab 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/AttachmentLoader.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/AttachmentLoader.java @@ -30,6 +30,7 @@ package com.esotericsoftware.spine.attachments; import com.esotericsoftware.spine.Skin; +import com.esotericsoftware.spine.utils.Null; /** The interface which can be implemented to customize creating and populating attachments. *

@@ -37,20 +38,26 @@ import com.esotericsoftware.spine.Skin; * Runtimes Guide. */ public interface AttachmentLoader { /** @return May be null to not load the attachment. */ + @Null public RegionAttachment newRegionAttachment (Skin skin, String name, String path); /** @return May be null to not load the attachment. */ + @Null public MeshAttachment newMeshAttachment (Skin skin, String name, String path); /** @return May be null to not load the attachment. */ + @Null public BoundingBoxAttachment newBoundingBoxAttachment (Skin skin, String name); - + /** @return May be null to not load the attachment. */ + @Null public ClippingAttachment newClippingAttachment (Skin skin, String name); /** @return May be null to not load the attachment. */ + @Null public PathAttachment newPathAttachment (Skin skin, String name); /** @return May be null to not load the attachment. */ + @Null public PointAttachment newPointAttachment (Skin skin, String name); } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/MeshAttachment.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/MeshAttachment.java index 228d243ac..5d650e7b5 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/MeshAttachment.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/MeshAttachment.java @@ -33,6 +33,9 @@ import static com.esotericsoftware.spine.utils.SpineUtils.*; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasRegion; + +import com.esotericsoftware.spine.utils.Null; + import com.badlogic.gdx.graphics.g2d.TextureRegion; /** An attachment that displays a textured mesh. A mesh has hull vertices and internal vertices within the hull. Holes are not @@ -218,8 +221,7 @@ public class MeshAttachment extends VertexAttachment { return parentMesh; } - /** @param parentMesh May be null. */ - public void setParentMesh (MeshAttachment parentMesh) { + public void setParentMesh (@Null MeshAttachment parentMesh) { this.parentMesh = parentMesh; if (parentMesh != null) { bones = parentMesh.bones; @@ -261,7 +263,7 @@ public class MeshAttachment extends VertexAttachment { return copy; } - /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. **/ + /** Returns a new mesh with the {@link #parentMesh} set to this mesh's parent mesh, if any, else to this mesh. */ public MeshAttachment newLinkedMesh () { MeshAttachment mesh = new MeshAttachment(name); mesh.region = region; diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/SkeletonAttachment.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/SkeletonAttachment.java index e8fccb513..bc0c59d89 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/SkeletonAttachment.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/SkeletonAttachment.java @@ -30,6 +30,7 @@ package com.esotericsoftware.spine.attachments; import com.esotericsoftware.spine.Skeleton; +import com.esotericsoftware.spine.utils.Null; /** Attachment that displays a skeleton. */ public class SkeletonAttachment extends Attachment { @@ -44,8 +45,7 @@ public class SkeletonAttachment extends Attachment { return skeleton; } - /** @param skeleton May be null. */ - public void setSkeleton (Skeleton skeleton) { + public void setSkeleton (@Null Skeleton skeleton) { this.skeleton = skeleton; } diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/VertexAttachment.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/VertexAttachment.java index 40781bf4d..e67d7c54a 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/VertexAttachment.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/attachments/VertexAttachment.java @@ -36,6 +36,7 @@ import com.badlogic.gdx.utils.FloatArray; import com.esotericsoftware.spine.Bone; import com.esotericsoftware.spine.Skeleton; import com.esotericsoftware.spine.Slot; +import com.esotericsoftware.spine.utils.Null; /** Base class for an attachment with vertices that are transformed by one or more bones and can be deformed by a slot's * {@link Slot#getDeform()}. */ @@ -122,24 +123,26 @@ abstract public class VertexAttachment extends Attachment { /** Deform keys for the deform attachment are also applied to this attachment. * @return May be null if no deform keys should be applied. */ + @Null public VertexAttachment getDeformAttachment () { return deformAttachment; } /** @param deformAttachment May be null if no deform keys should be applied. */ - public void setDeformAttachment (VertexAttachment deformAttachment) { + public void setDeformAttachment (@Null VertexAttachment deformAttachment) { this.deformAttachment = deformAttachment; } /** The bones which affect the {@link #getVertices()}. The array entries are, for each vertex, the number of bones affecting * the vertex followed by that many bone indices, which is the index of the bone in {@link Skeleton#getBones()}. Will be null * if this attachment has no weights. */ + @Null public int[] getBones () { return bones; } /** @param bones May be null if this attachment has no weights. */ - public void setBones (int[] bones) { + public void setBones (@Null int[] bones) { this.bones = bones; } @@ -169,7 +172,7 @@ abstract public class VertexAttachment extends Attachment { return id; } - /** Does not copy id (generated) or name (set on construction). **/ + /** Does not copy id (generated) or name (set on construction). */ void copyTo (VertexAttachment attachment) { if (bones != null) { attachment.bones = new int[bones.length]; diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/Null.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/Null.java new file mode 100644 index 000000000..b14f75ca6 --- /dev/null +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/Null.java @@ -0,0 +1,5 @@ + +package com.esotericsoftware.spine.utils; + +public @interface Null { +} diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDataLoader.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDataLoader.java index 22009f1b5..2a827142c 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDataLoader.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/SkeletonDataLoader.java @@ -67,8 +67,7 @@ public class SkeletonDataLoader extends AsynchronousAssetLoader getDependencies (String fileName, FileHandle file, SkeletonDataParameter parameter) { + public Array getDependencies (String fileName, FileHandle file, @Null SkeletonDataParameter parameter) { if (parameter == null) return null; if (parameter.attachmentLoader != null) return null; Array dependencies = new Array(); diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TwoColorPolygonBatch.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TwoColorPolygonBatch.java index 07317e9ee..ff0ff65d7 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TwoColorPolygonBatch.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/utils/TwoColorPolygonBatch.java @@ -83,7 +83,7 @@ public class TwoColorPolygonBatch implements PolygonBatch { private float lightPacked = Color.WHITE.toFloatBits(); private float darkPacked = Color.BLACK.toFloatBits(); - /** Number of rendering calls, ever. Will not be reset unless set manually. **/ + /** Number of rendering calls, ever. Will not be reset unless set manually. */ public int totalRenderCalls = 0; public TwoColorPolygonBatch () { diff --git a/spine-libgdx/spine-skeletonviewer/.settings/org.eclipse.jdt.core.prefs b/spine-libgdx/spine-skeletonviewer/.settings/org.eclipse.jdt.core.prefs index b1afb4ec3..95f665389 100644 --- a/spine-libgdx/spine-skeletonviewer/.settings/org.eclipse.jdt.core.prefs +++ b/spine-libgdx/spine-skeletonviewer/.settings/org.eclipse.jdt.core.prefs @@ -2,26 +2,31 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault -org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable -org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=com.esotericsoftware.spine.utils.Null +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=ignore org.eclipse.jdt.core.compiler.problem.deprecation=ignore org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore @@ -29,71 +34,81 @@ org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning -org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore -org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=ignore org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=1.7 diff --git a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java index 8e5f6a9f7..9ed26bc2b 100644 --- a/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java +++ b/spine-libgdx/spine-skeletonviewer/src/com/esotericsoftware/spine/SkeletonViewer.java @@ -226,7 +226,6 @@ public class SkeletonViewer extends ApplicationAdapter { state = new AnimationState(new AnimationStateData(skeletonData)); state.addListener(new AnimationStateAdapter() { - public void event (TrackEntry entry, Event event) { ui.toast(event.getData().getName()); } @@ -243,7 +242,6 @@ public class SkeletonViewer extends ApplicationAdapter { ui.window.getTitleLabel().setText(skeletonFile.name()); { - Array items = new Array(); for (Skin skin : skeletonData.getSkins()) items.add(skin.getName()); @@ -719,6 +717,7 @@ public class SkeletonViewer extends ApplicationAdapter { }); slotsSetupPoseButton.addListener(new ChangeListener() { public void changed (ChangeEvent event, Actor actor) { + skeleton.getRootBone().getChildren(); if (skeleton != null) skeleton.setSlotsToSetupPose(); } });