Skip to content

Commit

Permalink
indentation changes only
Browse files Browse the repository at this point in the history
  • Loading branch information
ceki committed Dec 9, 2014
1 parent 26b0111 commit 7a57f1a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 42 deletions.
38 changes: 38 additions & 0 deletions .idea/codeStyleSettings.xml

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

84 changes: 42 additions & 42 deletions slf4j-api/src/main/java/org/slf4j/helpers/Util.java
Expand Up @@ -26,61 +26,61 @@


/**
*
* An internal utility class.
*
* @author Alexandre Dorokhine
* @author Ceki Gülcü
*/
public final class Util {

private Util() {}
private Util() {}

This comment has been minimized.

Copy link
@adorokhine

adorokhine Dec 12, 2014

Contributor

Can you clarify what the code style is for slf4j? The LoggerFactory, for instance, seems to use two spaces for indentation.

This comment has been minimized.

Copy link
@ceki

ceki Dec 13, 2014

Author Member

At present time, we use 2 spaces for indentation. See commit 55a650f08c The subsequent commit 3b9f0ec0 on that file should consist of minor modifications but I have not used nor looked at it yet.

On the slf4j mailing list I have made a proposal to use a different style. See http://markmail.org/message/3ux6efdqlmirh4hn

Do you have any preferences on the matter?

This comment has been minimized.

Copy link
@adorokhine

adorokhine Dec 13, 2014

Contributor

@ceki I am currently used to 2 space indentation, but I don't have a strong preference. As long as the style used is consistent, it is fine with me. I would prefer spaces to tabs.

If you are going to change the style, though, I would prefer if you did it all at once in a single commit, rather than switching on a per-function (c0f5835#diff-c08423cacedd1336ae1a43091828e7abR119) or per-file (7a57f1a#diff-834453f38a9a96a56815c23ab71d9446R36) basis. I think the latter approach would lead to confusion and mismatched code styles.

On the whole, I think I would prefer to keep it the way it is, especially since changing the style would lead to merge conflicts for existing pull requests and contributors. But no strong opinions.

(FYI I tried to post this on the list, but my message was rejected saying I don't have permission to post there.)

Cheers,
Alex.

This comment has been minimized.

Copy link
@ceki

ceki Dec 13, 2014

Author Member

@adorokhine I agree. I'll revert the files you mentioned to the existing style.

As for posting on the slf4j-dev list, you need to post from the same address with which you subscribed to the list.


/**
* In order to call {@link SecurityManager#getClassContext()}, which is a
* protected method, we add this wrapper which allows the method to be visible
* inside this package.
*/
private static final class ClassContextSecurityManager extends SecurityManager {
protected Class<?>[] getClassContext() {
return super.getClassContext();
/**
* In order to call {@link SecurityManager#getClassContext()}, which is a
* protected method, we add this wrapper which allows the method to be visible
* inside this package.
*/
private static final class ClassContextSecurityManager extends SecurityManager {
protected Class<?>[] getClassContext() {
return super.getClassContext();
}
}
};
private static final ClassContextSecurityManager SECURITY_MANAGER =
new ClassContextSecurityManager();

/**
* Returns the name of the class which called the invoking method.
* @return the name of the class which called the invoking method.
*/
public static Class<?> getCallingClass() {
Class<?>[] trace = SECURITY_MANAGER.getClassContext();
String thisClassName = Util.class.getName();
private static final ClassContextSecurityManager SECURITY_MANAGER = new ClassContextSecurityManager();

// Advance until Util is found
int i;
for (i = 0 ; i < trace.length ; i++) {
if (thisClassName.equals(trace[i].getName()))
break;
}
/**
* Returns the name of the class which called the invoking method.
*
* @return the name of the class which called the invoking method.
*/
public static Class<?> getCallingClass() {
Class<?>[] trace = SECURITY_MANAGER.getClassContext();
String thisClassName = Util.class.getName();

// Advance until Util is found
int i;
for(i = 0; i < trace.length; i++) {
if(thisClassName.equals(trace[i].getName()))
break;
}

// trace[i] = Util; trace[i+1] = caller; trace[i+2] = caller's caller
if (i >= trace.length || i + 2 >= trace.length) {
throw new IllegalStateException(
"Failed to find org.slf4j.helpers.Util or its caller in the stack; " +
"this should not happen");
// trace[i] = Util; trace[i+1] = caller; trace[i+2] = caller's caller
if(i >= trace.length || i + 2 >= trace.length) {
throw new IllegalStateException(
"Failed to find org.slf4j.helpers.Util or its caller in the stack; " +
"this should not happen");
}

return trace[i + 2];
}

return trace[i+2];
}
static final public void report(String msg, Throwable t) {
System.err.println(msg);
System.err.println("Reported exception:");
t.printStackTrace();
}

static final public void report(String msg, Throwable t) {
System.err.println(msg);
System.err.println("Reported exception:");
t.printStackTrace();
}

static final public void report(String msg) {
System.err.println("SLF4J: " +msg);
}
static final public void report(String msg) {
System.err.println("SLF4J: " + msg);
}
}

0 comments on commit 7a57f1a

Please sign in to comment.