Class BambooConstantUtils

java.lang.Object
com.atlassian.bamboo.util.BambooConstantUtils

public class BambooConstantUtils extends Object
A collection of utility methods to prevent inlining of Bamboo constants by the Java compiler.

Use these methods when defining constants which may be used by external code. Using them guarantees that the Java compiler does not inline the values of the constants in the compiled classes.

Changing constants not wrapped by such utility methods (and not protected in any other way) may lead to plugin compatibility issues.

Example:


 import static com.atlassian.bamboo.util.BambooConstantUtils.preventInlining;

 public class BambooConstants {
     public static final String  BAMBOO_VERSION      = preventInlining("6.0.0");
     public static final int     BAMBOO_BUILD_NUMBER = preventInlining(60000);
     public static final boolean BAMBOO_DEV_MODE     = preventInlining(false);
 }
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    preventInlining(boolean value)
    Prevent inlining of a boolean Bamboo constant by the Java compiler.
    static byte
    preventInlining(byte value)
    Prevent inlining of a byte Bamboo constant by the Java compiler.
    static char
    preventInlining(char value)
    Prevent inlining of a char Bamboo constant by the Java compiler.
    static double
    preventInlining(double value)
    Prevent inlining of a double Bamboo constant by the Java compiler.
    static float
    preventInlining(float value)
    Prevent inlining of a float Bamboo constant by the Java compiler.
    static int
    preventInlining(int value)
    Prevent inlining of a int Bamboo constant by the Java compiler.
    static long
    preventInlining(long value)
    Prevent inlining of a long Bamboo constant by the Java compiler.
    static short
    preventInlining(short value)
    Prevent inlining of a short Bamboo constant by the Java compiler.
    static <T> T
    preventInlining(T value)
    Prevent inlining of any type Bamboo constant by the Java compiler.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • preventInlining

      public static boolean preventInlining(boolean value)
      Prevent inlining of a boolean Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static byte preventInlining(byte value)
      Prevent inlining of a byte Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static short preventInlining(short value)
      Prevent inlining of a short Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static int preventInlining(int value)
      Prevent inlining of a int Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static long preventInlining(long value)
      Prevent inlining of a long Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static float preventInlining(float value)
      Prevent inlining of a float Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static double preventInlining(double value)
      Prevent inlining of a double Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static char preventInlining(char value)
      Prevent inlining of a char Bamboo constant by the Java compiler.
      See Also:
    • preventInlining

      public static <T> T preventInlining(T value)
      Prevent inlining of any type Bamboo constant by the Java compiler.
      See Also: