Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the pieces of code preventing Kamon from building on modern JDKs #1351

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ push, pull_request ]

jobs:
ci:
runs-on: ubuntu-latest
runs-on: self-hosted
env:
JAVA_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
Expand All @@ -19,7 +19,7 @@ jobs:
- name: Test
run: sbt -v ";+core/test;+instrumentation/test;+reporters/test"
lint:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- uses: actions/checkout@v1
- uses: coursier/cache-action@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
release:
runs-on: ubuntu-latest
runs-on: self-hosted
env:
JAVA_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
JVM_OPTS: -Xms5120M -Xmx5120M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
/*
* Copyright 2013-2021 The Kamon Project <https://kamon.io>
*
* Licensed 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.
*/

package kamon.context.generated.binary.context;


// Code generated by colf(1); DO NOT EDIT.
// The compiler used schema file Context.colf.


import static java.lang.String.format;
Expand All @@ -40,20 +25,16 @@
* @author generated by colf(1)
* @see <a href="https://github.com/pascaldekloe/colfer">Colfer's home</a>
*/
@javax.annotation.Generated(value="colf(1)", comments="Colfer from schema file Context.colf")
public class BooleanTag implements Serializable {

/** The upper limit for serial byte sizes. */
public static int colferSizeMax = 16 * 1024 * 1024;




public String key;

public boolean value;


/** Default constructor */
public BooleanTag() {
init();
Expand Down Expand Up @@ -88,7 +69,6 @@ public static class Unmarshaller {
* @param buf the initial buffer or {@code null}.
*/
public Unmarshaller(InputStream in, byte[] buf) {
// TODO: better size estimation
if (buf == null || buf.length == 0)
buf = new byte[Math.min(BooleanTag.colferSizeMax, 2048)];
this.buf = buf;
Expand Down Expand Up @@ -133,7 +113,6 @@ public BooleanTag next() throws IOException {
this.i = 0;
} else if (i == buf.length) {
byte[] src = this.buf;
// TODO: better size estimation
if (offset == 0) this.buf = new byte[Math.min(BooleanTag.colferSizeMax, this.buf.length * 4)];
System.arraycopy(src, this.offset, this.buf, 0, this.i - this.offset);
this.i -= this.offset;
Expand All @@ -154,6 +133,16 @@ public BooleanTag next() throws IOException {

}

/**
* Gets the serial size estimate as an upper boundary, whereby
* {@link #marshal(byte[],int)} ≤ {@link #marshalFit()} ≤ {@link #colferSizeMax}.
* @return the number of bytes.
*/
public int marshalFit() {
long n = 1L + 6 + (long)this.key.length() * 3 + 1;
if (n < 0 || n > (long)BooleanTag.colferSizeMax) return BooleanTag.colferSizeMax;
return (int) n;
}

/**
* Serializes the object.
Expand All @@ -165,22 +154,16 @@ public BooleanTag next() throws IOException {
* @throws IllegalStateException on an upper limit breach defined by {@link #colferSizeMax}.
*/
public byte[] marshal(OutputStream out, byte[] buf) throws IOException {
// TODO: better size estimation
if (buf == null || buf.length == 0)
buf = new byte[Math.min(BooleanTag.colferSizeMax, 2048)];

while (true) {
int i;
try {
i = marshal(buf, 0);
} catch (BufferOverflowException e) {
buf = new byte[Math.min(BooleanTag.colferSizeMax, buf.length * 4)];
continue;
}

out.write(buf, 0, i);
return buf;
int n = 0;
if (buf != null && buf.length != 0) try {
n = marshal(buf, 0);
} catch (BufferOverflowException e) {}
if (n == 0) {
buf = new byte[marshalFit()];
n = marshal(buf, 0);
}
out.write(buf, 0, n);
return buf;
}

/**
Expand Down Expand Up @@ -323,16 +306,8 @@ public int unmarshal(byte[] buf, int offset, int end) {

// {@link Serializable} Colfer extension.
private void writeObject(ObjectOutputStream out) throws IOException {
// TODO: better size estimation
byte[] buf = new byte[1024];
int n;
while (true) try {
n = marshal(buf, 0);
break;
} catch (BufferUnderflowException e) {
buf = new byte[4 * buf.length];
}

byte[] buf = new byte[marshalFit()];
int n = marshal(buf, 0);
out.writeInt(n);
out.write(buf, 0, n);
}
Expand Down Expand Up @@ -371,7 +346,7 @@ public void setKey(String value) {
/**
* Sets kamon/context/generated/binary/context.BooleanTag.key.
* @param value the replacement.
* @return {link this}.
* @return {@code this}.
*/
public BooleanTag withKey(String value) {
this.key = value;
Expand All @@ -397,7 +372,7 @@ public void setValue(boolean value) {
/**
* Sets kamon/context/generated/binary/context.BooleanTag.value.
* @param value the replacement.
* @return {link this}.
* @return {@code this}.
*/
public BooleanTag withValue(boolean value) {
this.value = value;
Expand All @@ -420,8 +395,8 @@ public final boolean equals(Object o) {
public final boolean equals(BooleanTag o) {
if (o == null) return false;
if (o == this) return true;
return o.getClass() == BooleanTag.class
&& (this.key == null ? o.key == null : this.key.equals(o.key))

return (this.key == null ? o.key == null : this.key.equals(o.key))
&& this.value == o.value;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
/*
* Copyright 2013-2021 The Kamon Project <https://kamon.io>
*
* Licensed 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.
*/

package kamon.context.generated.binary.context;


// Code generated by colf(1); DO NOT EDIT.
// The compiler used schema file Context.colf.


import static java.lang.String.format;
Expand All @@ -39,7 +24,6 @@
* @author generated by colf(1)
* @see <a href="https://github.com/pascaldekloe/colfer">Colfer's home</a>
*/
@javax.annotation.Generated(value="colf(1)", comments="Colfer from schema file Context.colf")
public class Context implements Serializable {

/** The upper limit for serial byte sizes. */
Expand All @@ -49,13 +33,10 @@ public class Context implements Serializable {
public static int colferListMax = 64 * 1024;




public Tags tags;

public Entry[] entries;


/** Default constructor */
public Context() {
init();
Expand Down Expand Up @@ -91,7 +72,6 @@ public static class Unmarshaller {
* @param buf the initial buffer or {@code null}.
*/
public Unmarshaller(InputStream in, byte[] buf) {
// TODO: better size estimation
if (buf == null || buf.length == 0)
buf = new byte[Math.min(Context.colferSizeMax, 2048)];
this.buf = buf;
Expand Down Expand Up @@ -136,7 +116,6 @@ public Context next() throws IOException {
this.i = 0;
} else if (i == buf.length) {
byte[] src = this.buf;
// TODO: better size estimation
if (offset == 0) this.buf = new byte[Math.min(Context.colferSizeMax, this.buf.length * 4)];
System.arraycopy(src, this.offset, this.buf, 0, this.i - this.offset);
this.i -= this.offset;
Expand All @@ -157,6 +136,21 @@ public Context next() throws IOException {

}

/**
* Gets the serial size estimate as an upper boundary, whereby
* {@link #marshal(byte[],int)} ≤ {@link #marshalFit()} ≤ {@link #colferSizeMax}.
* @return the number of bytes.
*/
public int marshalFit() {
long n = 1L + 6;
if (this.tags != null) n += 1 + (long)this.tags.marshalFit();
for (Entry o : this.entries) {
if (o == null) n++;
else n += o.marshalFit();
}
if (n < 0 || n > (long)Context.colferSizeMax) return Context.colferSizeMax;
return (int) n;
}

/**
* Serializes the object.
Expand All @@ -169,22 +163,16 @@ public Context next() throws IOException {
* @throws IllegalStateException on an upper limit breach defined by either {@link #colferSizeMax} or {@link #colferListMax}.
*/
public byte[] marshal(OutputStream out, byte[] buf) throws IOException {
// TODO: better size estimation
if (buf == null || buf.length == 0)
buf = new byte[Math.min(Context.colferSizeMax, 2048)];

while (true) {
int i;
try {
i = marshal(buf, 0);
} catch (BufferOverflowException e) {
buf = new byte[Math.min(Context.colferSizeMax, buf.length * 4)];
continue;
}

out.write(buf, 0, i);
return buf;
int n = 0;
if (buf != null && buf.length != 0) try {
n = marshal(buf, 0);
} catch (BufferOverflowException e) {}
if (n == 0) {
buf = new byte[marshalFit()];
n = marshal(buf, 0);
}
out.write(buf, 0, n);
return buf;
}

/**
Expand Down Expand Up @@ -311,16 +299,8 @@ public int unmarshal(byte[] buf, int offset, int end) {

// {@link Serializable} Colfer extension.
private void writeObject(ObjectOutputStream out) throws IOException {
// TODO: better size estimation
byte[] buf = new byte[1024];
int n;
while (true) try {
n = marshal(buf, 0);
break;
} catch (BufferUnderflowException e) {
buf = new byte[4 * buf.length];
}

byte[] buf = new byte[marshalFit()];
int n = marshal(buf, 0);
out.writeInt(n);
out.write(buf, 0, n);
}
Expand Down Expand Up @@ -359,7 +339,7 @@ public void setTags(Tags value) {
/**
* Sets kamon/context/generated/binary/context.Context.tags.
* @param value the replacement.
* @return {link this}.
* @return {@code this}.
*/
public Context withTags(Tags value) {
this.tags = value;
Expand All @@ -385,7 +365,7 @@ public void setEntries(Entry[] value) {
/**
* Sets kamon/context/generated/binary/context.Context.entries.
* @param value the replacement.
* @return {link this}.
* @return {@code this}.
*/
public Context withEntries(Entry[] value) {
this.entries = value;
Expand All @@ -408,8 +388,8 @@ public final boolean equals(Object o) {
public final boolean equals(Context o) {
if (o == null) return false;
if (o == this) return true;
return o.getClass() == Context.class
&& (this.tags == null ? o.tags == null : this.tags.equals(o.tags))

return (this.tags == null ? o.tags == null : this.tags.equals(o.tags))
&& java.util.Arrays.equals(this.entries, o.entries);
}

Expand Down
Loading