Skip to content

Commit

Permalink
feat: update objenesis to 3.3
Browse files Browse the repository at this point in the history
Java library to instantiate a new object of a particular class

Issue: deepin-community/sig-deepin-sysdev-team#547
Log: update repo
  • Loading branch information
xzl01 committed Apr 19, 2024
1 parent 43d0456 commit abd2a7d
Show file tree
Hide file tree
Showing 157 changed files with 425 additions and 337 deletions.
16 changes: 0 additions & 16 deletions .gitignore

This file was deleted.

6 changes: 6 additions & 0 deletions .idea/copyright/Objenesis.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ You can find the website and user documentation at [objenesis.org](http://objene

## Project status

[![Build Status](https://travis-ci.org/easymock/objenesis.svg?branch=master)](https://travis-ci.org/easymock/objenesis)
[![Build Status](https://github.com/easymock/objenesis/actions/workflows/ci.yml/badge.svg)](https://github.com/easymock/objenesis/actions/workflows/ci.yml?query=branch%3Amaster)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.objenesis/objenesis/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.objenesis/objenesis)

## Environment setup

I'm using:
- Maven 3.6.3
- IntelliJ Ultimate 2021.1 (thanks to JetBrains for the license) (it should also work with Eclipse)
- Maven 3.8.5
- IntelliJ Ultimate 2022.1.2 (thanks to JetBrains for the license) (it should also work with Eclipse)

To configure your local workspace:
- Import the Maven parent project to Eclipse or IntelliJ
Expand All @@ -41,10 +41,18 @@ This build will create the source and javadoc jars and run spotbugs.

### Run the Android TCK

####Install required tools:
##### MacOs / *nix
- Install the Android SDK (`brew cask install android-sdk`)
- Install `platform-tools` and `build-tools` using the sdkmanager (`sdkmanager "platform-tools" "build-tools"`)
- Add an `ANDROID_HOME` to target the Android SDK (`export ANDROID_HOME=$(realpath $(echo "$(dirname $(readlink $(which sdkmanager)))/../.."))`)
- Configure a device (real or simulated) and launch it (use API 26, after that it asks for a signature, that isn't supported yet)
#### Windows
- [Install Android Studio](https://developer.android.com/studio)
- Launch studio and install SDK and emulator
- Add an `ANDROID_HOME` to environmental variables (path used to install SDK on previous step)

####Run
- Configure a device (real or simulated) and launch it (use **API 26**, after that it asks for a signature, that isn't supported yet)
- Activate the debug mode if it's a real device
- `mvn package -Pandroid`

Expand Down Expand Up @@ -85,19 +93,23 @@ cd benchmark

## To upgrade the Maven wrapper

`mvn -N io.takari:maven:wrapper -Dmaven=3.6.3`
`mvn wrapper:wrapper`

## To update the license

`mvn validate license:format -Pall`

## To run modernizer

`mvn modernizer:modernizer -Pall`

## To release

* Add the release notes in `website/site/content/notes.html` You use this code to generate it

```bash
# Get the milestone matching the version
version=(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d'-' -f1)
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d'-' -f1)
milestone=$(curl -s "https://api.github.com/repos/easymock/objenesis/milestones" | jq ".[] | select(.title==\"$version\") | .number")
echo "<h1>Version $version ($(date '+%Y-%m-%d'))</h1>"
echo
Expand Down
4 changes: 2 additions & 2 deletions SupportedJVMs.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# List of currently supported JVMs

* Sun/Oracle Hotspot VM, versions 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9 to 16
* OpenJDK 6, 7, 8, 9 to 16
* Sun/Oracle Hotspot VM, versions 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 9 to 18
* OpenJDK 6, 7, 8, 9 to 18
* Android API level 8 to 30 (Serialization support starting from Honeycomb)
* Azul Zulu (tested on 1.8.0_45-b14)
* Azul Zing JDK 1.8 (tested on 1.8.0-zing_16.10.1.0-b2)
Expand Down
2 changes: 1 addition & 1 deletion benchmark/launch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright 2006-2021 the original author or authors.
# Copyright 2006-2022 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
12 changes: 6 additions & 6 deletions benchmark/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2006-2021 the original author or authors.
Copyright 2006-2022 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@
<parent>
<groupId>org.objenesis</groupId>
<artifactId>objenesis-parent</artifactId>
<version>3.2</version>
<version>3.3</version>
</parent>

<artifactId>objenesis-benchmark</artifactId>
Expand All @@ -32,7 +32,7 @@
<properties>
<!-- Minimum for this module is 1.8 -->
<javac.target>1.8</javac.target>
<jmh.version>1.26</jmh.version>
<jmh.version>1.35</jmh.version>
<uberjar.name>benchmarks</uberjar.name>
</properties>

Expand All @@ -56,9 +56,9 @@
</dependency>

<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.3.0</version>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.12.12</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,8 @@
*/
package org.objenesis.benchmark;

import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.NoOp;
import net.bytebuddy.ByteBuddy;
import net.bytebuddy.dynamic.loading.ClassLoadingStrategy;
import org.objenesis.Objenesis;
import org.objenesis.ObjenesisStd;
import org.objenesis.instantiator.ObjectInstantiator;
Expand Down Expand Up @@ -44,7 +44,7 @@
public class ConcurrentGetInstantiator {

private static final int COUNT = 1000;

public static class SunInstantiatorStrategy extends BaseInstantiatorStrategy {
@Override
public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) {
Expand All @@ -55,10 +55,10 @@ public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) {
InstantiatorStrategy std = new StdInstantiatorStrategy();
InstantiatorStrategy single = new SingleInstantiatorStrategy(SunReflectionFactoryInstantiator.class);
InstantiatorStrategy custom = new SunInstantiatorStrategy();

Objenesis cachedStd = new ObjenesisStd();
Objenesis uncachedStd = new ObjenesisStd(false);

Class<?>[] toInstantiate = new Class[COUNT];

@State(Scope.Thread)
Expand All @@ -68,11 +68,14 @@ public static class ThreadState {

@Setup
public void setUp() {
ClassLoadingStrategy<ClassLoader> strategy = new ClassLoadingStrategy.ForUnsafeInjection();

for(int i = 0; i < COUNT; i++) {
Enhancer enhancer = new Enhancer();
enhancer.setUseCache(false); // deactivate the cache to get a new instance each time
enhancer.setCallbackType(NoOp.class);
Class<?> c = enhancer.createClass();
Class<?> c = new ByteBuddy()
.subclass(Object.class)
.make()
.load(ConcurrentGetInstantiator.class.getClassLoader(), strategy)
.getLoaded();
toInstantiate[i] = c;
}
}
Expand All @@ -91,12 +94,12 @@ public ObjectInstantiator<?> single(ThreadState state) {
public ObjectInstantiator<?> custom(ThreadState state) {
return custom.newInstantiatorOf(toInstantiate[state.index++ % COUNT]);
}

@Benchmark
public ObjectInstantiator<?> cachedStd(ThreadState state) {
return cachedStd.getInstantiatorOf(toInstantiate[state.index++ % COUNT]);
}

@Benchmark
public ObjectInstantiator<?> uncachedStd(ThreadState state) {
return uncachedStd.getInstantiatorOf(toInstantiate[state.index++ % COUNT]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
22 changes: 22 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
objenesis (3.3-3) unstable; urgency=medium

* Don't suggest the -doc package anymore.

-- Markus Koschany <[email protected]> Tue, 17 Jan 2023 14:18:23 +0100

objenesis (3.3-2) unstable; urgency=medium

* Declare compliance with Debian Policy 4.6.2.
* Drop binary package libobjenesis-java-doc. Do not build the javadoc.
(Closes: #1028709)

-- Markus Koschany <[email protected]> Tue, 17 Jan 2023 14:10:36 +0100

objenesis (3.3-1) unstable; urgency=medium

* New upstream version 3.3.
* Switch to debhelper-compat = 13.
* Declare compliance with Debian Policy 4.6.1.

-- Markus Koschany <[email protected]> Sat, 06 Aug 2022 13:57:48 +0200

objenesis (3.2-1) unstable; urgency=medium

* New upstream version 3.2.
Expand Down
29 changes: 2 additions & 27 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ Priority: optional
Maintainer: Debian Java Maintainers <[email protected]>
Uploaders: Markus Koschany <[email protected]>
Build-Depends:
debhelper-compat (= 12),
debhelper-compat (= 13),
default-jdk,
default-jdk-doc,
junit4,
libmaven-bundle-plugin-java,
libmaven-enforcer-plugin-java,
libmaven-javadoc-plugin-java,
maven-debian-helper (>= 1.4)
Standards-Version: 4.6.0
Standards-Version: 4.6.2
Vcs-Git: https://salsa.debian.org/java-team/objenesis.git
Vcs-Browser: https://salsa.debian.org/java-team/objenesis
Homepage: http://www.objenesis.org/
Expand All @@ -21,7 +19,6 @@ Package: libobjenesis-java
Architecture: all
Depends: ${maven:Depends}, ${misc:Depends}
Recommends: ${maven:OptionalDepends}
Suggests: libobjenesis-java-doc
Description: Java library to instantiate a new object of a particular class
Objenesis is a small Java library that serves one purpose: to instantiate a
new object of a particular class.
Expand All @@ -37,25 +34,3 @@ Description: Java library to instantiate a new object of a particular class
Objenesis aims to overcomes these restrictions by bypassing the constructor
on object instantiation.

Package: libobjenesis-java-doc
Architecture: all
Section: doc
Depends: ${maven:DocDepends}, ${misc:Depends}
Recommends: ${maven:DocOptionalDepends}
Suggests: libobjenesis-java
Description: Documentation for Objenesis
Objenesis is a small Java library that serves one purpose: to instantiate a
new object of a particular class.
Java already supports this dynamic instantiation of classes using
Class.newInstance(). However, this only works if the class has an appropriate
constructor. There are many times when a class cannot be instantiated this
way, such as when the class contains:
* Constructors that require arguments.
* Constructors that have side effects.
* Constructors that throw exceptions.
As a result, it is common to see restrictions in libraries stating that
classes must require a default constructor.
Objenesis aims to overcomes these restrictions by bypassing the constructor
on object instantiation.
.
This is the API documentation for Objenesis
4 changes: 2 additions & 2 deletions debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Upstream-Contact: Objenesis Team <http://groups.google.com/group/objenesis-dev>
Source: https://github.com/easymock/objenesis

Files: *
Copyright: 2006-2021 Joe Walnes, Henri Tremblay, Leonardo Mesquita
Copyright: 2006-2022 Joe Walnes, Henri Tremblay, Leonardo Mesquita
License: Apache-2.0

Files: debian/*
Copyright: 2010, Gabriele Giacone <[email protected]>
2014-2021, Markus Koschany <[email protected]>
2014-2022, Markus Koschany <[email protected]>
License: Apache-2.0

License: Apache-2.0
Expand Down
10 changes: 0 additions & 10 deletions debian/libobjenesis-java-doc.doc-base.api

This file was deleted.

1 change: 0 additions & 1 deletion debian/libobjenesis-java-doc.install

This file was deleted.

1 change: 1 addition & 0 deletions debian/maven.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# maven.test.skip=true

project.build.sourceEncoding=ISO-8859-1
maven.javadoc.skip=true
5 changes: 3 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ git push --tags

mvn release:perform -Pall,full,release

echo "Please add the release notes in github"
echo "Please add the release notes and copy binaries (main, tck, tck-android, exotic) in github"
open "https://github.com/easymock/objenesis/tags"
pause

# Release the jars now on central staging
echo "Check everything is alright, next step will release to central"
echo "Right now you need to delete some of the projects from staging"
open "https://oss.sonatype.org/#welcome"
pause
mvn nexus-staging:release
# mvn nexus-staging:release

echo "Close the milestone in GitHub and create the new one"
open "https://github.com/easymock/objenesis/milestones"
Expand Down
4 changes: 2 additions & 2 deletions exotic/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright 2006-2021 the original author or authors.
Copyright 2006-2022 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@
<parent>
<groupId>org.objenesis</groupId>
<artifactId>objenesis-parent</artifactId>
<version>3.2</version>
<version>3.3</version>
</parent>

<artifactId>objenesis-exotic</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit abd2a7d

Please sign in to comment.