package-private Questions
2
Solved
In Java, we have 4 visibility levels. Except public and private, we have protected level and a default level (with no modifier) that is also called "package-local" or "package-privat...
Geiss asked 30/12, 2020 at 20:33
3
Solved
In case the tests are in a different module than the production code (which is common), what's the best way to make internal functions visible for tests?
In Java, I would have the production code ...
Irredentist asked 28/2, 2016 at 14:52
2
Solved
I'm mainly a Java developer and wonder about structure when writing unit test in kotlin,
Assuming there's no package-private in kotlin
private to restrict visibility to the file
internal to restri...
Weatherbeaten asked 3/12, 2019 at 13:36
5
Solved
I am trying to get an instance of a non-visible class, AKA package private class, using reflection. I was wondering if there was a way to switch the modifiers to make it public and then access it u...
Doubletime asked 22/2, 2013 at 2:5
4
Solved
I am looking for an explanation for the following behavior:
I have 6 classes, {a.A,b.B,c.C,a.D,b.E,c.F}, each having a package visible m() method that writes out the class name.
I have an a.Main ...
Guanaco asked 22/9, 2019 at 19:21
2
Solved
Why is the default access modifier in JUnit 5 package-private?
Tests in JUnit 4 had to be public.
What is the benefit of changing it to package-private?
Garv asked 18/3, 2019 at 6:50
1
Solved
This one is puzzling me. I created a minimal JAX-RS application based on JavaEE7 running on Wildfly 10.1.
@ApplicationPath("")
public class JAXRSConfiguration extends Application {
@Override
pu...
Legitimatize asked 6/10, 2017 at 9:20
1
In one package (a) I have two functional interfaces:
package a;
@FunctionalInterface
interface Applicable<A extends Applicable<A>> {
void apply(A self);
}
-
package a;
@Function...
Warty asked 26/10, 2016 at 19:11
7
Solved
I am a little confused over the term "package private" that some of the documentation uses, along with the usage of "default access." Aren't package-private and default access both synonymous with ...
Hui asked 24/3, 2011 at 7:34
1
Solved
I just found out about a pretty weird behaviour of Scala scoping when bytecode generated from Scala code is used from Java code. Consider the following snippet using Spark (Spark 1.4, Hadoop 2.6):
...
Basin asked 11/6, 2016 at 8:37
8
Solved
I am learning Java recently, and I came across the notion of package-private classes, which is the default if we don't specify anything. But then I realized:
I seldom see the use of package-priva...
Legislator asked 24/6, 2011 at 16:3
3
Solved
I just came accross the following code, which surprised me a little bit, I converted it to a simple SSCEE here though:
custompackage.package1.MyEnum.java
public enum MyEnum implements MyInterface...
Wenwenceslaus asked 22/5, 2014 at 15:43
2
Solved
I love access control in any language, but I find that in Java I almost never (if ever) use the package-private access modifier (or lack thereof).
I realize that inner classes can be private...
Aloeswood asked 22/8, 2013 at 14:12
3
Please don't post an answer saying "you shouldn't do this." I don't plan to use this in production code, but only for some hacking fun.
In answering this question, I wanted to run some arbitrary u...
Katheleenkatherin asked 22/3, 2013 at 6:3
3
Solved
Because of an issue with package name aux under Windows, I am moving a helper class within the package hierarchy of my library from
de.sciss.scalainterpreter.aux
to
de.sciss.scalainterpreter
...
Watt asked 28/8, 2012 at 19:35
2
I have 2 Java packages, A & B. Let's say that some classes in package B want to use some classes in package A however, when a developer comes along and develops package C (or, say, application ...
Pritchard asked 12/6, 2012 at 2:30
2
Solved
Since an enum constructor can only be invoked by its constants, why is it then allowed to be package-private?
Landlady asked 12/10, 2011 at 23:57
5
Solved
This is possible in Java:
package x;
public class X {
// How can this method be public??
public Y getY() {
return new Y();
}
}
class Y {}
So what's a good reason the Java compiler lets me...
Kussell asked 10/3, 2011 at 19:49
2
Solved
I'm learning C# and coming from a Java world, I was a little confused to see that C# doesn't have a "package private". Most comments I've seen regarding this amount to "You cannot do it; the langua...
Nobelium asked 11/2, 2011 at 1:55
4
Solved
Suppose I have a class in my package org.jake and it has a method with default access (no modifier). Then the method is visible inside the package only.
However, when someone receives the jar of m...
Genevieve asked 21/5, 2010 at 6:25
1
© 2022 - 2024 — McMap. All rights reserved.