• Intro Headers Instructions Macros Commands
  • Fork me on GitHub
    • Introduction
    • How to install bnd
    • Guided Tour
    • Guided Tour Workspace & Projects
    • Concepts
    • Best practices
    • Build
    • Project Setup
    • Generating JARs
    • Versioning
    • Baselining
    • Service Components
    • Metatype
    • Contracts
    • Bundle Annotations
    • Accessor Properties
    • SPI Annotations
    • Resolving Dependencies
    • Launching
    • Startlevels
    • Testing
    • Testing with Launchpad
    • Packaging Applications
    • JPMS Libraries
    • Wrapping Libraries to OSGi Bundles
    • Generating Documentation
    • Commands
    • For Developers
    • Tips for Windows users
    • Tools bound to bnd
    • Headers
    • Instruction Reference
    • Instruction Index
    • Macro Reference
    • Macro Index
    • Plugins
    • External Plugins
    • Settings
    • Errors
    • Warnings
    • Frequently Asked Questions
  • -upto VERSION

    /** * This method is about compatibility. New behavior can be conditionally * introduced by calling this method and passing what version this behavior * was introduced. This allows users of bnd to set the -upto instructions to * the version that they want to be compatible with. If this instruction is * not set, we assume the latest version. */

    Version	upto	= null;
    
    public boolean since(Version introduced) {
    	if (upto == null) {
    		String uptov = getProperty(UPTO);
    		if (uptov == null) {
    			upto = Version.HIGHEST;
    			return true;
    		}
    		if (!Version.VERSION.matcher(uptov).matches()) {
    			error("The %s given version is not a version: %s", UPTO, uptov);
    			upto = Version.HIGHEST;
    			return true;
    		}
    
    		upto = new Version(uptov);
    	}
    	return upto.compareTo(introduced) >= 0;
    }
    
    • GitHub