Skip to content
Closed
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
43 changes: 24 additions & 19 deletions jme3-core/src/main/java/com/jme3/math/Quaternion.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2023 jMonkeyEngine
* Copyright (c) 2009-2025 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -31,10 +31,16 @@
*/
package com.jme3.math;

import com.jme3.export.*;
import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import com.jme3.util.TempVars;

import java.io.*;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.logging.Logger;

/**
Expand Down Expand Up @@ -1086,7 +1092,7 @@ public Quaternion fromAxes(Vector3f xAxis, Vector3f yAxis, Vector3f zAxis) {
* non-null, elements modified)
* @throws IllegalArgumentException if {@code axes.length != 3}
*/
public void toAxes(Vector3f axes[]) {
public void toAxes(Vector3f[] axes) {
if (axes.length != 3) {
throw new IllegalArgumentException(
"Axes array must have three elements");
Expand Down Expand Up @@ -1460,7 +1466,6 @@ public int hashCode() {
hash = 37 * hash + Float.floatToIntBits(z);
hash = 37 * hash + Float.floatToIntBits(w);
return hash;

}

/**
Expand Down Expand Up @@ -1525,32 +1530,32 @@ public Quaternion lookAt(Vector3f direction, Vector3f up) {
* Serializes to the specified exporter, for example when saving to a J3O
* file. The current instance is unaffected.
*
* @param e the exporter to use (not null)
* @param ex the exporter to use (not null)
* @throws IOException from the exporter
*/
@Override
public void write(JmeExporter e) throws IOException {
OutputCapsule cap = e.getCapsule(this);
Copy link
Member

@yaRnMcDonuts yaRnMcDonuts Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that minor changes to variable names like this should be avoided when possible.

I would be just as content with the variable named "oc" or "o" or "outputCapsule" or even "outputCap" and for exception to be "e" or "exc" or "ex" or "exception" and I think that being indifferent to this is a beneficial skill for developers. My own code is full of a mixture of these, and it really depends how I felt that day when I was coding.

I actually strongly believe that it is good practice for a coder to not form a preference in these regards, as it leads to time wasted when things don't fit your preference. And in a room with 10 devs, they will all tell you they prefer it a different way of naming variables and lead to an unproductive debate. So I opt to accept all variable naming formats (as long as they are sensical or spell out the whole word or use acronyms appropriately)

So I'd suggest trying to minimize these types of changes where it doesn't offer much objective benefit, just to keep the review process as fast and focused as possible.

cap.write(x, "x", 0);
cap.write(y, "y", 0);
cap.write(z, "z", 0);
cap.write(w, "w", 1);
public void write(JmeExporter ex) throws IOException {
OutputCapsule oc = ex.getCapsule(this);
oc.write(x, "x", 0);
oc.write(y, "y", 0);
oc.write(z, "z", 0);
oc.write(w, "w", 1);
}

/**
* De-serializes from the specified importer, for example when loading from
* a J3O file.
*
* @param importer the importer to use (not null)
* @param im the importer to use (not null)
* @throws IOException from the importer
*/
@Override
public void read(JmeImporter importer) throws IOException {
InputCapsule cap = importer.getCapsule(this);
x = cap.readFloat("x", 0);
y = cap.readFloat("y", 0);
z = cap.readFloat("z", 0);
w = cap.readFloat("w", 1);
public void read(JmeImporter im) throws IOException {
InputCapsule ic = im.getCapsule(this);
x = ic.readFloat("x", 0);
y = ic.readFloat("y", 0);
z = ic.readFloat("z", 0);
w = ic.readFloat("w", 1);
}

/**
Expand Down