Restore original license headers in Maven versioning package

This commit is contained in:
Minecrell 2018-07-01 20:39:10 +02:00 committed by LexManos
parent 97627e7fb9
commit eb94dc5c48
6 changed files with 122 additions and 117 deletions

View File

@ -16,15 +16,12 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.common.versioning;
/**
* Describes an artifact version in terms of its components, converts it to/from a string and
* compares two versions.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
//I beleive this is a unique class except that it uses the same name so that ComparibleVersion can stay the same.
//Best reference I could find: https://github.com/apache/maven/blob/3501485ed2280e30ba74eb9f0e1c6422b68a3228/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ArtifactVersion.java
//This entire package *should* be removed and updated to normal maven-artifact library in 1.13.
public interface ArtifactVersion
extends Comparable<ArtifactVersion>
{

View File

@ -1,24 +1,27 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Repackaged and some modifications done by Forge, see in-line comments.
*/
package net.minecraftforge.fml.common.versioning;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
@ -102,19 +105,19 @@ public class ComparableVersion
this.value = new BigInteger( str );
}
@Override
@Override //Forge: Add @Override
public int getType()
{
return INTEGER_ITEM;
}
@Override
@Override //Forge: Add @Override
public boolean isNull()
{
return BigInteger_ZERO.equals( value );
}
@Override
@Override //Forge: Add @Override
public int compareTo( Item item )
{
if ( item == null )
@ -138,7 +141,7 @@ public class ComparableVersion
}
}
@Override
@Override //Forge: Add @Override
public String toString()
{
return value.toString();
@ -192,13 +195,13 @@ public class ComparableVersion
this.value = ALIASES.getProperty( value , value );
}
@Override
@Override //Forge: Add @Override
public int getType()
{
return STRING_ITEM;
}
@Override
@Override //Forge: Add @Override
public boolean isNull()
{
return ( comparableQualifier( value ).compareTo( RELEASE_VERSION_INDEX ) == 0 );
@ -223,7 +226,7 @@ public class ComparableVersion
return i == -1 ? ( _QUALIFIERS.size() + "-" + qualifier ) : String.valueOf( i );
}
@Override
@Override //Forge: Add @Override
public int compareTo( Item item )
{
if ( item == null )
@ -247,7 +250,7 @@ public class ComparableVersion
}
}
@Override
@Override //Forge: Add @Override
public String toString()
{
return value;
@ -262,18 +265,15 @@ public class ComparableVersion
extends ArrayList<Item>
implements Item
{
/**
*
*/
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L; //Forge: added to quiet warnings.
@Override
@Override //Forge: Add @Override
public int getType()
{
return LIST_ITEM;
}
@Override
@Override //Forge: Add @Override
public boolean isNull()
{
return ( size() == 0 );
@ -295,7 +295,7 @@ public class ComparableVersion
}
}
@Override
@Override //Forge: Add @Override
public int compareTo( Item item )
{
if ( item == null )
@ -340,7 +340,7 @@ public class ComparableVersion
}
}
@Override
@Override //Forge: Add @Override
public String toString()
{
StringBuilder buffer = new StringBuilder( "(" );
@ -462,25 +462,25 @@ public class ComparableVersion
return isDigit ? new IntegerItem( buf ) : new StringItem( buf, false );
}
@Override
@Override //Forge: Add @Override
public int compareTo( ComparableVersion o )
{
return items.compareTo( o.items );
}
@Override
@Override //Forge: Add @Override
public String toString()
{
return value;
}
@Override
@Override //Forge: Add @Override
public boolean equals( Object o )
{
return ( o instanceof ComparableVersion ) && canonical.equals( ( (ComparableVersion) o ).canonical );
}
@Override
@Override //Forge: Add @Override
public int hashCode()
{
return canonical.hashCode();

View File

@ -16,7 +16,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.fml.common.versioning;
public class DefaultArtifactVersion implements ArtifactVersion

View File

@ -1,24 +1,27 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Repackaged by Forge, otherwise unchangeed
*/
package net.minecraftforge.fml.common.versioning;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Occurs when a version is invalid.
*

View File

@ -1,26 +1,28 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Repackaged and some modifications done by Forge, see in-line comments.
*/
package net.minecraftforge.fml.common.versioning;
import net.minecraft.util.text.translation.I18n;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import net.minecraft.util.text.translation.I18n; //Forge: Added imports
import javax.annotation.Nullable;
/**
@ -40,7 +42,7 @@ public class Restriction
public static final Restriction EVERYTHING = new Restriction( null, false, null, false );
public Restriction( @Nullable ArtifactVersion lowerBound, boolean lowerBoundInclusive, @Nullable ArtifactVersion upperBound,
public Restriction( @Nullable ArtifactVersion lowerBound, boolean lowerBoundInclusive, @Nullable ArtifactVersion upperBound, //Forge: Added @Nullable
boolean upperBoundInclusive )
{
this.lowerBound = lowerBound;
@ -49,7 +51,7 @@ public class Restriction
this.upperBoundInclusive = upperBoundInclusive;
}
@Nullable
@Nullable //Forge: Added @Nullable
public ArtifactVersion getLowerBound()
{
return lowerBound;
@ -60,7 +62,7 @@ public class Restriction
return lowerBoundInclusive;
}
@Nullable
@Nullable //Forge: Added @Nullable
public ArtifactVersion getUpperBound()
{
return upperBound;
@ -184,7 +186,7 @@ public class Restriction
return true;
}
@Override
@Override //Forge: Added @Override
public String toString()
{
StringBuilder buf = new StringBuilder();
@ -204,6 +206,7 @@ public class Restriction
return buf.toString();
}
//Forge: Added toStringFriendly, uses Minecraft's localization engine to create user friendly localized message.
public String toStringFriendly()
{
if ( getLowerBound() == null && getUpperBound() == null )

View File

@ -1,25 +1,25 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Repackaged and some modifications done by Forge, see in-line comments.
*/
package net.minecraftforge.fml.common.versioning;
/*
* Modifications by cpw under LGPL 2.1 or later
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.util.ArrayList;
@ -27,8 +27,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import com.google.common.base.Joiner;
import com.google.common.base.Joiner; //Forge: Add Imports
import javax.annotation.Nullable;
/**
@ -75,7 +74,8 @@ public class VersionRange
return new VersionRange( recommendedVersion, copiedRestrictions );
}
//Forge: Added factory function
/**
* Factory method, for custom versioning schemes
* @param version version
@ -86,6 +86,7 @@ public class VersionRange
{
return new VersionRange(version, restrictions);
}
/**
* Create a version range from a string representation
* <p/>
@ -103,7 +104,7 @@ public class VersionRange
* @throws InvalidVersionSpecificationException
*
*/
public static VersionRange createFromVersionSpec( @Nullable String spec )
public static VersionRange createFromVersionSpec( @Nullable String spec ) //Forge: Added @Nullable
throws InvalidVersionSpecificationException
{
if ( spec == null )
@ -230,14 +231,10 @@ public class VersionRange
return restriction;
}
public static VersionRange createFromVersion( String version , ArtifactVersion existing)
public static VersionRange createFromVersion( String version , ArtifactVersion existing) //Forge: Added existing argument
{
List<Restriction> restrictions = Collections.emptyList();
if (existing == null)
{
existing = new DefaultArtifactVersion( version );
}
return new VersionRange(existing , restrictions );
return new VersionRange(existing != null ? existing : new DefaultArtifactVersion( version ), restrictions );
}
/**
@ -472,20 +469,24 @@ public class VersionRange
return restrictions;
}
//Forge: Removed getSelectedVersion and isSelectedVersion
@Override
@Override //Forge: Added @Override
public String toString()
{
if ( recommendedVersion != null )
{
return recommendedVersion.getVersionString();
return recommendedVersion.getVersionString(); //Forge: Version string specifically.
}
else
{
return Joiner.on(',').join(restrictions);
return Joiner.on(',').join(restrictions); //Forge: Changeed from iterator loop to joiner.
}
}
//Forge: Added friendly {localized} toString
public String toStringFriendly()
{
if ( recommendedVersion != null )
@ -539,7 +540,7 @@ public class VersionRange
return !restrictions.isEmpty() && recommendedVersion == null;
}
@Override
@Override //Forge: Added @Override
public boolean equals( Object obj )
{
if ( this == obj )
@ -561,7 +562,7 @@ public class VersionRange
return equals;
}
@Override
@Override //Forge: Added @Override
public int hashCode()
{
int hash = 7;
@ -570,11 +571,13 @@ public class VersionRange
return hash;
}
//Forge: Added @isUnboundedAbove
public boolean isUnboundedAbove()
{
return restrictions.size() == 1 && restrictions.get(0).getUpperBound() == null && !restrictions.get(0).isUpperBoundInclusive();
}
//Forge: Added @getLowerBoundString
public String getLowerBoundString()
{
return restrictions.size() == 1 ? restrictions.get(0).getLowerBound().getVersionString() : "";