Java™ Community

508 readers
1 users here now

Write once, run anywhere (WORA)

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.

The community

News, Technical discussions, research papers and assorted things of interest related to the Java Platform.

Rules
  1. Follow the Code of Conduct.
  2. Please make sure its a question/topic/post that would be new to most members. In Lemmy the publications are not closed, so you can continue to participate in them, regardless of the time they were published.
  3. Lemmy doesn’t have flags yet, so please tag your posts with [Question], [Help], [Learning], [JVM], [JSE], [OpenJDK], [Eclipse] or other you may think is appropriate.

Related communities

Resources

founded 5 years ago
MODERATORS
1
2
 
 

This is kind of an open question for me: does any code coverage tool work in Java with Junit5? I'll admit that I'm no Java configuration specialist, so I find the complexity of XML-based configuration systems to be quite opaque. I've got a few simple Maven-based build projects on hand and I wanted to add code coverage to the test harnesses. Unfortunately, I have never managed to get one stood up and running. I do this all the time with Python pytest/coverage tools, but it's been elusive for Java projects.

Could someone here please point me to a working example of any Java project using Maven / Junit5 / [any code coverage system]?

My latest attempt to get a working example came from this howto: https://howtodoinjava.com/junit5/jacoco-test-coverage/

But, it once again gave me the: [INFO]


jacoco-maven-plugin:0.8.7:report (default-report) @ JUnit5Examples


[INFO] Skipping JaCoCo execution due to missing execution data file.

As near as I can tell, JaCoCo just never runs. Ever. It's been very frustrating. I've read tutorials, followed suggestions on configuring surefire in various ways. I've pulled misc repo that claim to have it working. I've tried different computers with different OSes, versions of java, different maven installs, etc. There's something somewhere that I'm missing and after months of off and on attempts to get this working I'm at my wit's end.

Please help.

3
 
 

What's the best way to help Lemmy users organise into productive communities?

On Reddit we have:

  • r/java - Java news and discussion. Not about learning the language or getting help with Java problems
  • r/learnjava - learning to use the Java language, platform, its tools, or parts of its ecosystem (libraries)
  • r/javahelp - Getting help with Java (in practice, much the same content as r/learnjava)

So far, on Lemmy I've found the following (with only the very start of an active membership building up in each)

Are there other communities out there already?

How do we avoid fragmentation? Where there's overlap, are there reasoned opinions on how to converge (eg matching instance policies to the audience)?

 

Do we just encourage communities to peer-link until critical mass develops and community activity-levels speak for themselves? Or is that just likely to split the community until community owners promote migration towards a 'common space' for each type of content?

4
 
 

I am wondering if anyone can help me.

I have an issue with compiling some code in Eclipse but not with IntelliJ or javac.

I am using sneakyThrow to bubble a checked exception up through 2 streams.

Here is the smallest reproducible code I can make:

import java.io.IOException;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class Example {
	public static void main(String[] args)
	throws IOException {
		List<List<Integer>> input = List.of(List.of(1, 2), List.of(2, 4));

		// Should return any List whose elements are all even.
		List<List<Integer>> output = input.stream()
			.filter(bubblePredicate(o -> o.stream()
				.allMatch(bubblePredicate(i -> {
					if (i > 10) {
						throw new IOException("Number too large.");
					}
					return i % 2 == 0;
				}))))
			.collect(Collectors.toList());

		System.out.println(output);
	}

	private interface ThrowingPredicate<S, E extends Exception> {
		boolean test(S s) throws E;
	}

	private static <S, E extends Exception> Predicate<S> bubblePredicate(ThrowingPredicate<S, E> callable)
	throws E {
		return s -> {
			try {
				return callable.test(s);
			}
			catch (Exception e) {
				sneakyThrow(e);
				return false;
			}
		};
	}

	private static <E extends Throwable> void sneakyThrow(Exception exception)
	throws E {
		throw (E)exception;
	}
}

Compiles and runs completely fine with javac 11.0.12, but doesn't on Eclipse 4.21.0.I20210906-0500 nor Eclipse 4.27.0.20230309-1200.

Has anyone encountered this before, or have any idea what I am misunderstanding?

5
6
 
 

Tuples, templating, type-safe data access, units and measurements, extension methods, and countless other features exist, seemingly in perpetuity, in every language but Java! But no longer, thanks to the Manifold project.

There is an interesting reddit thread discussing whether Manifold is actually a JVM language and not just a "Java compiler plugin".

7
8
9
10
 
 

I wanted to start learning Java's Spring Framework and Spring Boot. Coming from Node.JS, I found this article to be an amazing introduction to Spring's concepts.

11
12
13
14
15
 
 

cross-posted from: https://lemmy.ml/post/84798

Mmm. A lot of legacy plugins works with Eclipse components. 😥

16
17
1
submitted 3 years ago* (last edited 3 years ago) by [email protected] to c/[email protected]
18
19
1
submitted 3 years ago* (last edited 3 years ago) by [email protected] to c/[email protected]
 
 

The Terasology project was born from a Minecraft-inspired tech demo and is becoming a stable platform for various types of gameplay settings in a voxel world. The creators and maintainers are a diverse mix of software developers, designers, game testers, graphic artists, and musicians. We encourage others to join!

20
21
1
submitted 3 years ago* (last edited 3 years ago) by [email protected] to c/[email protected]
22
23
24
25
view more: next ›